Incorrect syntax near INTO OUTFILE
<p>I want to output my select query result in csv file, googling for some time i found this.</p>

<pre><code>SELECT * from appointment_master where doctorid=1266 INTO OUTFILE 'Filename.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
</code></pre>

<p>I don't know what is wrong but i am getting error near 'INTO' which is <code>Incorrect syntax near INTO</code>. I am using MSSQL server 2014.</p>

<p>thank you.</p>