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 / saravanan sankar
CREATE PROCEDURE create_table
@table varchar(20)
AS
BEGIN
declare @string varchar(5000)
set @string = 'CREATE TABLE '+ @table +'(id int,name char(20))'
END
exec(@string)
//FIRST RUN PROCEDURE ABOVE AND THEN EXECUTES
EXEC create_table 'TABLE1'
| Is This Answer Correct ? | 8 Yes | 1 No |
Post New Answer View All Answers
What is Federation and Federation Member?
Explain what is the difference between a local and a global temporary table?
Can sub report data source be different from that of the parent report?
What do you mean by SQL injection attack?
What is NOT NULL Constraint in sql server 2012?
Define inner join in sql server joins?
Do you know what are the properties of the relational tables?
What are the properties of the relational tables?
What is data compression? : sql server database administration
What is self contained sub query?
Write an sql query for deleting duplicate rows?
What’s the distinction between dropping a info and taking a info offline?
Do you know what is replace and stuff function in sql server?
List the various tools available for performance tuning?
Find first and last day of current month in sql server