how to export data from sql server to csv file using query?
['Open SQL Server Management Studio.', 'Go to Tools > Options > Query Results > SQL Server > Results To Text.', 'On the far right, there is a drop down box called Output Format.', 'Choose Comma Delimited and click OK.']