Posted by Chris H on 01/30/08 20:33
Hi,
I am trying to create a routine for generating tables from a master
response table. The end result would increment the variable
"somevalue" by one and then create the next table (ie: TESTTEST2). Is
there a way to insert the variable into the Table Name as well as one
or more of the Field Names within the table? I've tried some
different syntax variations and haven't hit on the right combo yet!
.....other stuff.....
....
DECLARE @somevalue AS INT
SET @somevalue = 1
frontend:
IF somevalue > 10
BEGIN TRANSACTION
GO
CREATE TABLE TESTTEST+CAST(@somevalue AS char(2))
(Company_Id char(10),
Question_Q+CAST(@somevalue AS char(2)) char(200),
Response_Q char(40),
Short_Answer_Q char(40))
GO
COMMIT
@somevalue = @somevalue+1
GOTO front_end
Thanks for any assistance!
Chris.
[Back to original message]
|