This is one of those questions whose answer will depend on the RDBMS/utility being used. For instance, you CAN do this with Oracle if you are using SQL*Plus (substitution variables) or PL/SQL (dynamic SQL). I'm sure you can do it with other RDBMSs; the details will vary.
In SQL Server, you must create and execute a dynamic SQL statement.
Declare @name char (17), @sql nvarchar(200)
Set @name = 'c.coverage_code_1'
Set @sql = 'select @name from #temptable c'
exec (@sql) Terry L. Broadbent FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.