Re: Create Table with Variable included in Table Name
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Wed, 30 Jan 2008 22:44:20 +0000 (UTC)
Chris H (chollstein@xxxxxxxxxxxxxxxxxxxxxxxxx) writes:
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!
You can read here how to do to it - and why you probably shouldn't.
http://www.sommarskog.se/dynamic_sql.html.
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.
- References:
- Create Table with Variable included in Table Name
- From: Chris H
- Create Table with Variable included in Table Name
- Prev by Date: Re: Inserting multiple records into two tables...with a twist
- Next by Date: Re: trig errors
- Previous by thread: Create Table with Variable included in Table Name
- Next by thread: Re: Create Table with Variable included in Table Name
- Index(es):
Relevant Pages
|