Symptoms:
SQL Server ‘:setvar’ Error

Root Cause:

The :setvar only works in SQL command mode, so you are possibly within normal SQL execution in the management studio and have not swapped to command mode.

Solution:

In MSSMS, Query->SQLCMD Mode

Advertisements