Reputation: 1121
When executing a stored procedure using SQLCMD with the following parameters:
. sqlcmd -S $sql_server -U $sql_usr -P $sql_pwd -d $sql_db -Q "EXEC $storedProc $dateVariable, $regionType, ALM.10.2.33.1" -V 1 -b
The following message is received:
Incorrect syntax near '.'.
If I pass ALM_10_2_33_1 instead of ALM.10.2.33.1, the stored procedure is executed perfectly.
Thanks,
Upvotes: 2
Views: 6986
Reputation: 432657
Delimit the parameter correctly with single quotes
"EXEC $storedProc $dateVariable, $regionType, 'ALM.10.2.33.1'"
SQL Server has quirk that allows (var)char parameters to be specified without delimiters if they don't contain certain characters like .
.
You can see it in MSDN
EXEC sp_addserver <'new_name\instancename'>, local
But if you check sp_addserver, @local
is varchar(10)
, and 'LOCAL'
is mentioned as the value required.
Upvotes: 4