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
What do you mean by tablesample?
What is a unique key constraint?
What command must you use to include the not null constraint after a table has already been created?
How to create a stored procedure with a statement block in ms sql server?
How to create a simple table to test triggers in ms sql server?
How to get the definition of a trigger back?
1)what is the difference between Reinitializing a Subscription and synchronization the subscription? 2)when to use reinitializing ? 3)when to use synchronization? 4)when adding table or deleting a table what to do?(reinz.. or syn) 5)when adding a column what to do?
Define tool Manage Statistics in SQL Server 2000 query ?
What is the maximum size of a dimension? : sql server analysis services, ssas
What are the different type of replication in sql server?
What is sharding?
Explain the use of keyword with encryption. Create a store procedure with encryption?
SQL Server Architecture ?
How to change parameter value inside the report?
How do users use Report Builder with SQL Server data sources?