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 happens if null values are involved in datetime operations?

967


What is a matrix in ssrs?

151


How many ways to create table-valued functions?

973


How to list all objects in a given schema?

1052


What is 1nf normalization form?

1025


Is truncate a dml command?

937


It is important form e to get the information from log files of applications executed by the task scheduler? Does sql studio save these log files? : sql server management studio

1031


can a database be shrunk to 0 bytes, if not, why? : Sql server administration

1202


What is indexing and its types?

1010


What is transaction server isolation?

1030


Tell me what do you understand by a view? What does the with check option clause for a view do?

1014


How to edit table in sql server 2017?

920


How to create an index on a view?

1062


What is rs.exe utility?

156


Why SQL Agent is used?

1134