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,
Delimit the parameter correctly with single quotes
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
But if you check sp_addserver,
@localisvarchar(10), and'LOCAL'is mentioned as the value required.