Toad World® Forums

SQL Server Substitution Variables

I am trying to reproduce the substitution variables that work well for Oracle. ie.

Select &fieldname as ‘&fieldname’ from &tblName

Select lastname, ‘lastname’ from Employees

In SQL Server I would expect the following to work but it does not. The colon only seems to work as a value not a column or table name

Select :fieldname as ‘:fieldname’ from :tblName

Thanks for any direction you can provide

Retainiac

semicolons are Oracle. @ is Sql Server. You may need to declare them as well.