Forum Discussion
mrperfectloser
Nov 30, 2021Copper Contributor
Syntax error with :OUT and C:/ - SQL Query to CSV File
Hi all,
I'm trying to export an SQL query for several tables into individual CSV files.
Im getting an error with the syntax with the colon in front of "OUT" and the backslash for the where I want to save the file to C:\....
_________
:OUT c:\XXXXXXX.csv
SELECT * FROM [XXXXXXX].[XXXXXX].XXXXX
GO
________
Is anyone able to tell me what I did wrong?
- olafhelperBronze Contributor
Looks like you try to run the query in a SSMS query window, right?
To run a SqlCmd script in SSMS you have to switch into SqlCmd mode first.
Menue "Query" => "SQLCMD-Mode"