Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 select statement with variable column name in sql ser 7.0

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-03-27 : 11:16:29
gopal writes "sir I am try to write a select statement in which we can pass column name through variable . How can i do it please give me answer. Query like ths

declare @str1 varchar(50)

set @str1 = "company_name"

select @str1 from company_table"

graz
Chief SQLTeam Crack Dealer

4149 Posts

Posted - 2002-03-27 : 11:16:29
Please read the Frequently Asked Questions page. Especially the section on dynamic SQL.
Go to Top of Page
   

- Advertisement -