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

Explain raiserror in sql server?

962


How to include date and time values in sql statements?

1046


What is intellisense?

990


what type of index will get created after executing the above statement? : Sql server database administration

920


What is raid? : SQL Server Architecture

1101


What are the advantages of log shipping?

929


Mention the different types of replication in sql server.

957


How to update a field in SQL after ALTERING a row?

1182


Tell me what is de-normalization and what are some of the examples of it?

958


What are the difference between “where” and “having” clause in sql server?

1003


Hi all, can any one please tell me the difference between sql server 2008 and orace 9i

1901


Does an index slow down updates on indexed columns?

912


Distinguish between commit and rollback?

899


can an order by clause be used in a creation of a view?

1099


what is the difference between delete table and truncate table commands? : Sql server database administration

963