Is it possible to create tables in stored procedures using
a variable for the table name?

Answers were Sorted based on User's Feedback



Is it possible to create tables in stored procedures using a variable for the table name?..

Answer / skybeaver

create proc ShowMeHow
as

declare @Cities table(
AirportCode char(3) not null primary key,
CityName varchar(255) not null
)

insert into @Cities values('LAX', 'Los Angeles')
insert into @Cities values('ORD', 'Chicago')

select * from @Cities
go

Is This Answer Correct ?    7 Yes 1 No

Is it possible to create tables in stored procedures using a variable for the table name?..

Answer / pradeep

One Can create Table using a variable. As #1 Answer
describe. You can only create a temp (memory) table but can
not create physical table.

It will give an error while attempting to execute : -

Create Table @VariableName( EmpID varchar(10),
EmpNm Varchar(100)
)

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More SQL Server Interview Questions

What is the Query of getting last 10 transaction Reports (like insert, update, Delete Data from Tabele) ?

4 Answers   Wipro,


What is the difference between for trigger and after trigger?

0 Answers  


can a table be moved to different filegroup? : Sql server administration

0 Answers  


What is mean by clustered index and non clustered index, give syntax of creation? : sql server database administration

0 Answers  


What is the datatype of rowid?

0 Answers  






What are joins in sql and what are the different types of joins?

0 Answers  


What are statistics?

0 Answers  


Do you know sql server 2008 backup compression?

0 Answers  


What is the difference between truncate and delete commands?

0 Answers  


what is sql server? : Sql server database administration

0 Answers  


What are transactions in sql?

0 Answers  


What is a trigger and types of a trigger?

0 Answers  


Categories