I'm beginner in SQL Server, and want to save query result auto in csv file.
This is the query:
EXEC master..xp_cmdshell'bcp "SELECT [ID]
,[FirstName]
,[LastName]
,[StartYear]
FROM [dbo].[Employees]" queryout "e:\text.txt" -c -T -x
but get this error:
Unclosed quotation mark after the character string 'bcp "SELECT [ID] ,[FirstName] ,[LastName] ,[StartYear] FROM [dbo].[Employees]" queryout "e:\text.txt" -c -T -x
What happened? How can I solve that?
I get this error: