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 are three major types of constraints?

1171


Explain user defined views?

1002


List out different types of normalizations in sql server and explain each of them?

968


What do you understand by intent locks?

1055


What is a non-clustered index?

1040


Create and insert into temp table in sql server?

1078


Can a stored procedure call itself or recursive stored procedure? How much level sp nesting is possible?

1073


What are system databases into sql server (2005/2008) : sql server database administration

1048


How to create a simple user defined function in ms sql server?

1065


What are parameterized reports? What are cascading parameters in ssrs reports?

165


What do you know about normalization and de- normalization?

965


In what sequence sql statement is processed?

1053


Your table has a large character field there are queries that use this field in their search clause what should you do?

921


What are the results of running this script?

974


Tell me about joins in database system and explain each in detail.

1103