I am using SQL Server Management Studio to run a script on SQL Server 2008. Following simple statement throws error "Incorrect syntax near ':'".
:setvar DatabaseName "USHR1.2"
Curious, what's going on here. Appreciate your help!
I am using SQL Server Management Studio to run a script on SQL Server 2008. Following simple statement throws error "Incorrect syntax near ':'".
:setvar DatabaseName "USHR1.2"
Curious, what's going on here. Appreciate your help!
use TSQL....
DECLARE @databaseName VARCHAR(7)
SET @databaseName = 'USHR1.2'
OK.. it was simple. Enabling the "SQLCMD Mode" from the SSMS menu solved the error. Thanks everyone for your replies.
I guess, there are tons of such "Incorrect syntax near 'x'" errors reported on stackoverflow. Guess, those will go away with this fix.