tc3596
Technical User
- Mar 16, 2001
- 283
I need to find a column name in a table. Here's what I have so far, but it obviously does not work.
(Select Name from syscolumns where name like 'end_bal_' + @Prd)
..@Prd is pre-set to 6 (which is the current period of the year)
This returns the column name (end_bal_6), which is perfect.
My problem is that I can't figure how to retieve those values from the table...
Select (Select Name from syscolumns where name like 'end_bal_' + @Prd)
From tbl
All I get is end_bal_6, (repeated over and over again). What I am doing wrong?
(Select Name from syscolumns where name like 'end_bal_' + @Prd)
..@Prd is pre-set to 6 (which is the current period of the year)
This returns the column name (end_bal_6), which is perfect.
My problem is that I can't figure how to retieve those values from the table...
Select (Select Name from syscolumns where name like 'end_bal_' + @Prd)
From tbl
All I get is end_bal_6, (repeated over and over again). What I am doing wrong?