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 |
|
willben
Starting Member
1 Post |
Posted - 2007-11-09 : 07:39:26
|
| Hi,I am hoping someone can assist me with the following problem I have.I would like to create 10 tables in a while loop, the query looks like this;DECLARE @I INTSET @I = 1WHILE( @I < 6 )BEGIN SELECT * INTO #AT_NEW@I FROM (SELECT * FROM MELON_AUDIT WHERE PROC_ID = @I UNION SELECT * FROM LITCHI_AUDIT WHERE PROC_ID = @I ) AS A SET @I = @I + 1ENDI thought that this might work but I keep getting an "incorrect syntax error near '@I'"Is there anybody that can help?Regards |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
|
|
|