Reply to Create Table with Variable included in Table Name

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация