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

Give the query of getting last two records from the table in SQL SERVER?

946


How to send email from database?

1009


Write an sql query to find first weekday of the month?

908


Beginning with sql server version 7 0, a new enhanced data type nchar was added what type of data is supported with this data type?

1001


What is sql server replication? : sql server replication

974


how you can get the list of largest tables in a database? : Sql server administration

1042


What is the use of @@spid?

993


Tell me what is difference between view and materialized view?

929


How will you optimize a stored procedure optimization?

1028


What are the different editions available in sql server 2000?

1042


What is rolap and its advantage? : sql server analysis services, ssas

1275


What is the minimum and maximum number of partitions required for a measure group? : sql server analysis services, ssas

1041


Explain full-text query in sql server?

992


Using the customer, and order table in northwind database, please write a query to produce xml?

1065


Is it safe to delete log files?

908