That would have the effect of :
select * from table where 'column1' = 'mytestdata'
In order to use dynamic column or table names, you have to use dynamic SQL,
just using variables will not work.
The link that Alejandro posted explains it in depth.
[quoted text, click to view] "luna" <luna_s@themoon.com> wrote in message
news:OvadnYsxdsiirGTbnZ2dneKdnZydnZ2d@giganews.com...
> can you use something like ?
>
> declare @column varchar(75)
>
> select @column=('column1')
>
> select * from table where @column='mytestdata'
>
> I understand you can do it dynamicaly by building a sql query but was just
> wondering if this way can be used
>
> cheers
>
> mark
>
>