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
Why use stored procedures in sql server?
What command must you use to include the not null constraint after a table has already been created?
Difference between 2NF &3NF ?
What is replace and stuff function in sql server?
Explain ranking functions?
Where sql server usernames and passwords are stored in a sql server?
Difference Between ORDER BY Clause and GROUP BY Clause in SQL?
What is the native system stored procedure to execute a command against all databases?
Can a database be shrunk with users active?
how would you write a sql query to compute a frequency table of a certain attribute involving two joins? What changes would you need to make if you want to order by or group by some attribute? What would you do to account for nulls?
How to find out what is the default collation in a database?
How do I create a partition table in sql server?
Explain about link server in sql server?
Do you know what is difference between index seek vs. Index scan?
What is star, snowflake and star flake schema? : sql server analysis services, ssas