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
Tell me what is log shipping?
Explain iaas, paas and saas?
Suppose you want to implement the many-to-many relationships while designing tables. How would you do it?
Explain how to send email from sql database?
What are various aggregate functions that are available?
How to choose all records from the table?
what is normalization? Explain different levels of normalization? : Sql server database administration
What is the server name in sql server?
What are system databases in ms sql server?
Explain primary key?
What are different backups available in sql server?
What were the latest updates to SQL Azure service?
Explain tablesample?
Explain a checkpoint?
Explain the categories of stored procedure?