I am new to MSSQL and I am thinking whether I can create a table with its name containing a variable. That is , I want to create a variable number of tables depending on the parameter passed to the stored procedure. Need Help on that. Thanks in advance.yes you can easily do that by little programming knowledge.|||
Quote:
Originally Posted by heavenl
hi all,
I am new to MSSQL and I am thinking whether I can create a table with its name containing a variable. That is , I want to create a variable number of tables depending on the parameter passed to the stored procedure. Need Help on that. Thanks in advance.
HI
I am sending an example .It will help you
[code]
create pro pro1(@.a int)
as
begin
while(@.a>0)
begin
exec('create table table+'+@.a)
set @.a=@.a-1
end
end
No comments:
Post a Comment