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 syntax for encrypting a column in SQL Server?

1060


If you are given access to a SQL Server, how do you find if the SQL Instance is a named instance or a default instance?

1042


What is explicit mode in sql server?

1018


Explain about Views?

1010


How many levels of sp nesting is possible?

999


What is the purpose of indexing?

1000


Explain mixed authentication mode of sql server?

991


Explain how to integrate the ssrs reports in application?

945


Explain concepts of analysis services?

893


How to find the login name linked to a given user name?

944


Difference between report and query parameter. Why do we need different type of parameter?

906


Explain primary key and foreign key constraints?

966


Explain an incremental backup?

939


Explain the disadvantages of cursors?

1053


What is the difference between char and varchar2 datatype in sql?

1009