Does anyone know how I can do an “indirect” SQL SELECT statement? (one in which the column to return from a table is not named explicitly, but is contained in a variable?)
For example, instead of this:
SELECT trailer FROM …. WHERE …
I need to be able to do something like this:
DECLARE @FieldName nVarChar(30)
SELECT @FieldName = ‘trailer’
SELECT @FieldName FROM … WHERE …
The third line in my example above doesn’t work like I need it to.
Thanks!
-tom