i want to create procedure for create table in sql server
2005

for example

create procedure create_table
@table varchar(20)
as
create @table(
id int,
name char(20)
)
but it will get error
what is solution?

Answer Posted / veeresh kethari

Here is the solution...

create proc CREATE_TABLE
@TableName varchar(50)
as
begin
declare @String nvarchar(max)
set @String='create table '+@TableName +'(ID int,Name
varchar(50))'
execute sp_executesql @String
end

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is bulkcopy in sql?

731


How many categories of functions based their return modes?

844


How to drop an existing user defined function in ms sql server?

785


Explain optimistic and pessimistic concurrency?

722


What is replace and stuff function in sql server?

732






can a database be shrunk with users active? : Sql server administration

757


What is the use of nvl work?

719


You want to implement the many-to-many relationship while designing tables. How would you do it?

755


What is a print index?

661


hi i am working as a testengineer , so i want to no the backend data base connection can any one tell mwe in detail

1974


Is truncate a dml command?

686


What are the Advantages of using CTE in sql server?

763


What is "scheduled jobs" or "scheduled tasks"?

725


How to override dml statements with triggers?

747


How to create a local temporary stored procedure?

685