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 |
|
ann06
Posting Yak Master
171 Posts |
Posted - 2010-06-08 : 02:38:50
|
| hi,i have this simple query where i declared the columns and table names as variables like thisDeclare @viewColumns NVARCHAR(254)set @viewColumns='docno,indocno,subject'Declare @viewTables NVARCHAR(500)set @viewTables = 'technical_main'select @viewColumns from @viewTablesits showing error 'Must declare the variable '@viewTables''.can't i do such ??thanks and regards |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2010-06-08 : 02:44:16
|
| Google for dynamic sql if your variables @viewColumns and @viewTables would change with time. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|