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 |
|
Christy
Starting Member
7 Posts |
Posted - 2007-05-10 : 13:37:05
|
| Can you declare a variable for the FROM?Example:=================DECLARE @SrcTbl varchar(50)set @SrcTbl = 'dbo.Test_31'select col1, col2,col3 Into #tempTblFrom @SrcTbl |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
Christy
Starting Member
7 Posts |
Posted - 2007-05-10 : 13:49:32
|
| I have a SQL script that needs to be ran for 31 different tables. the tables are identicial in structure, therefore I will run 1 script for all tables but I did not want to change the table name in 3 different places 31 times. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-05-11 : 06:05:06
|
| www.sommarskog.se/dynamic_sql.htmlMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|