Tuesday, March 20, 2012

Creating table by variable name

Hi
How can i Create a table with variable name
eg
suppose variable x=tab1
I want the table created to be tab1 if x=tab2 then table created shd be tab2.. so how can this be dynamically done(creation of tables as well as stored procs)

i tried : create table @.x .. it doesnt seem to work
please help
regardssomething like...

CREATE PROCEDURE [dbo].[usp_CreateTable]

@.tablename varchar(200)

AS

sp_executesql('create table ' + @.tablename + ' column definations etc ')|||thanks.. Ill try this out :-)

No comments:

Post a Comment