Wednesday, January 17, 2018

Solved - incorrect syntax near '\'- cmd /c

This is an error that is coming from SQL server and not from windows batch script.


If you are passing Parameter with special characters to your procedure make sure you separate the argument list by, (comma) and enclose it with single quotes


C:\Users\>cmd /c "G:\Scripts\bat_scriptToInvokeAStoredProcedure.bat 10/10/2017  12/10/2017 1"

content of .bat script is as follows.

"C:\Program Files\Microsoft SQL Server\120\Tools\Binn\osql"  -U informatica -P password -S DWHServerName\DWHServerName -d CDW -Q "exec p_Play_Populate_Trips '%1', '%2', '%3'"



No comments:

Post a Comment

Recently Executed queries

 SELECT     txt.TEXT AS [SQL Statement],     qs.EXECUTION_COUNT [No. Times Executed],     qs.LAST_EXECUTION_TIME AS [Last Time Executed],   ...