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 / patan

IF EXISTS (SELECT NAME FROM SYSOBJECTS WHERE NAME = 'PROCEDURENAME')
DROP PROCEDURE PROCEDURENAME
GO
CREATE PROCEDURE PROCEDURENAME
@TEST INT = 0

AS
BEGIN
--HERE CREATING TABLE
DECLARE @CREATE TABLE (ID INT ,NAME VARCHAR(20))

INSERT INTO @CREATE VALUES (1,'PATAN')
.
.
.
.
.
.
END

IN PROCEDURE WE CAN CREATE TABLE AND IT CAN USE THE OUR PROCEDURE @CREATE IS THE TABLE NAME

NOTE:WHILE RUNNING TIME WE CAN CREATE TABLE WITH THERE ALIES NAMES...

THANKS @ GOOD LUCK

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are logical database components? : SQL Server Architecture

1014


What is analysis service repository?

1011


What are the tools available in market as an alternative to sql server reporting services?

129


What do you mean by an execution plan?

1093


What is data block and how to define data block size?

1013


What do you mean by collation recursive stored procedure?

1042


What is store procedure? How do they work?

985


How to find table changes in sql server?

1096


Why do we backup Active Directory ?

1029


What are audit control procedures?

973


Explain timestamp datatype?

949


What are cursors and when they are useful?

1073


How to execute multiple stored procedures at one time in sql server?

987


Do you know concepts and capabilities of sql server?

1043


How to get a list of columns in a view using the "sp_help" stored procedure?

1022