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 is the use of keyword with encryption. Create a store procedure with encryption?
What types of Joins are possible with Sql Server?
What are the default system databases in sql server 2000?
Do you know what is sql service broker?
Describe the functionalities that views support.
Explain what are the events recorded in a transaction log?
How is table type constraint applied to a table?
What are the basic functions for master, msdb, model, tempdb and resource databases? : SQL Server Architecture
What is stored procedures?
What is the purpose of grouping data in a report?
What is ddl and dml commands?
How do I find the default sql server instance?
How do you set a trace flag in sql server?
What is implicit cursors?
Explain the ways to controlling cursor behavior?