Support Center

Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Existence of variables checked even if they're only in comments....

Tom Parker Jul 13, 2013 01:20AM AEST

We had a deployment with a variable "$(TableName)" that was only mentioned in comments, but we still had the error

2013-07-12 14:38:38 INFO [Deploy Script] ERROR: 'TableName' scripting variable not defined.

coming from the sqlcmd.exe step. Removing the references to it from the comments fixed the problem, but I'm very surprised that commented out variables matter!

Up -5 rated Down
Daniel Nolan Jul 15, 2013 06:19PM AEST ReadyRoll Agent

Hi Tom,

It does seem a bit odd that SQLCMD would validate variables within comments, since obviously there is no functional difference between variable name and its value.

The only reason I can think of for this is in the situation where comments are being included in a stored procedure, since SQL Server will include the comment along with the procedure code itself within the system catalogs. Someone may want to pass in a value to go into that comment, but again functionally there is no difference.

You may have to put a placeholder character between the “$” and the variable name to get around this, eg. — $ (VariableName)

Best Regards,


This question has received the maximum number of answers.
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
Invalid characters found