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.
| Author |
Topic |
|
real_pearl
Posting Yak Master
106 Posts |
Posted - 2004-06-22 : 02:39:30
|
| Is it possible to declare a variable in a query and after assigning value to it, we may be able to use it as a column for another table within the same query likeselect @column_name from(select @column_name = tpm.column_namefrom test_param_map tpm join wafer on tpm.lot_sequence = wafer.lot_sequence join P9240502_001 d on wafer.wafer_sequence = d.wafer_sequence where tpm.test_name = 'FCOM short') a join(select tpm.test_name, tpm.column_name, d.+@column_namefrom test_param_map tpm join wafer on tpm.lot_sequence = wafer.lot_sequence join P9240502_001 d on wafer.wafer_sequence = d.wafer_sequence where tpm.test_name = 'FCOM short') b ona.+@column_name = b.column_name |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-06-22 : 05:52:30
|
| i don't believe it is possible this way. but with the use of EXEC you could make it workexec 'select ' + @column_name + 'from ...'Go with the flow & have fun! Else fight the flow :) |
 |
|
|
|
|
|