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)
 variables for column names

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-01-21 : 10:08:44
Darren writes "Hi,

Could anyone please help me?

I'm trying to write a SELECT statement using a variable in place of a column name:

SELECT @char_calltp = calltype FROM loginfo WHERE callno = @callnum

SELECT @char_calltp FROM customercontracts WHERE companyid = @compid

but i just get back the same as if executing:

SELECT @char_calltp

Any comments would be greatly appreciated.

Darren"
   

- Advertisement -