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
Can sql server 2016 run on windows 7?
What is difference between drop truncate and delete?
What is replace and stuff function in sql server?
How do I find the query plan in sql server?
If you lose rights to your sql server instance what are the options to connect to sql server instance? : sql server security
Do you have any idea about the tcl commands?
What are the types of database schema? : sql server analysis services, ssas
Why do you need a sql server?
Name 3 of the features that the sql server built-in function loginproperty performs on standard logins? : sql server security
What is index in an assignment?
Benefits of Stored Procedures?
What is dbcc? Give few examples.
How to scale out a federation by Sql statement?
How to create database with physical files specified in ms sql server?
How to create prepared statements using odbc_prepare()?