I have this code
ALTER PROCEDURE [dbo].[tablepass12]
(@TableName nvarchar(20))
AS
BEGIN
DECLARE @SQL VARCHAR(8000)
SELECT @SQL = 'SQLCMD -S ICB3110\SQLEXPRESS -d teena -E -Q "SELECT * FROM "'+@TableName+' -o d:\processing\'+@TableName+'.csv'
EXEC MASTER..XP_CMDSHELL @SQL
END;
When execute it, I get this error
Msg 105, Level 15, State 1, Server ICB3110\SQLEXPRESS, Line 1
Unclosed quotation mark after the character string 'AIR_LINE '.Msg 102, Level 15, State 1, Server ICB3110\SQLEXPRESS, Line 1
Incorrect syntax near 'AIR_LINE '.