I have a stored procedure which I created and within this stored proc., I have a statement which will copy the structure of an existing table into a new table. Since I would like the new table name to be based on user intervention, this is my procedure:
Create Procedure TableCreation @NTable As Char(10) As
Select * Into @NTable From ETable Where '2' = '1'
@NTable is a parameter which I want to use as the new table name.
ETable is the existing tahle where I wish to do the structure copy from.
When I execute this stored proc., it will not work. It says @NTable not defined or something along those lines.
All my other stored procs. will work when I am doing an insert statement and passing params for the values, but the above will not work.
Any ideas?
I know if I remove the parameter and replace Select * into @NTable with Select * into NTable where NTable is a hard coded value, everything will work!
I'm dying here with frustration Any help from all you gurus would be appreciated!
Thanks again and take care!
Create Procedure TableCreation @NTable As Char(10) As
Select * Into @NTable From ETable Where '2' = '1'
@NTable is a parameter which I want to use as the new table name.
ETable is the existing tahle where I wish to do the structure copy from.
When I execute this stored proc., it will not work. It says @NTable not defined or something along those lines.
All my other stored procs. will work when I am doing an insert statement and passing params for the values, but the above will not work.
Any ideas?
I know if I remove the parameter and replace Select * into @NTable with Select * into NTable where NTable is a hard coded value, everything will work!
I'm dying here with frustration Any help from all you gurus would be appreciated!
Thanks again and take care!