Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is the function of sql server agent windows service?

1067


Define outer join in sql server joins?

922


If you want to send some data from access database to sql server database. What are different component of ssis will you use?

960


What do you mean by collation recursive stored procedure?

1042


What is difference between equi join and inner join?

918


Why it is recommended to avoid referencing a floating point column in the where clause?

948


What are the characteristics of modern DBMS?

1072


What's new in sql management studio for sql server? : sql server management studio

1051


Explain partitioned view?

1054


What is sql server agent and what are the two modes of authentication in sql server?

1035


What is xml datatype?

1064


How to provide column names in insert statements in ms sql server?

1130


How can you append an identity column to a temporary table?

925


what is the different types of backups available in sql server? : Sql server database administration

908


Why and when do stored procedure recompile?

966