[Solved] I have a code for a stored procedure to create a table .But it returns error message while executing.Can any one please help me to solve this? [closed]


At least immediately, I notice you are missing the end:

create procedure new_SP ( @tablename varchar(50)

)
as
  begin
    declare @xxx varchar(50)
    set  @xxx= 'create table '+@tablename+'( name varchar (50))'
    print @xxx
    exec (@xxx)
  end  -- you are missing this

If you add the END, then this should work. Just tested it in SQL Server 2008, using exec dbo.new_SP test and it resulted in a table.

See SQL Fiddle with Demo

0

solved I have a code for a stored procedure to create a table .But it returns error message while executing.Can any one please help me to solve this? [closed]