我想在csv文件中输出我的选择查询结果,谷歌搜索一段时间后我发现了这个。
SELECT * from appointment_master where doctorid=1266 INTO OUTFILE 'Filename.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
我不知道出了什么问题,但我在“INTO”附近发现错误Incorrect syntax near INTO
。我正在使用MSSQL server 2014。
答案 0 :(得分:0)
以下内容应该有效。
SELECT * INTO OUTFILE 'Filename.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM appointment_master;