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's sql server? : Sql server database administration

0 Answers  


What is the standby server?

0 Answers  


What is referential integrity and how is it achieved?

1 Answers   Adea Solutions,


What is stored procedure in SQL..??

2 Answers  


Explain the first normal form(1nf)?

0 Answers  


what is memory-optimized nonclustered indexes

0 Answers  


hi. suppose one person goal is strong knowledge on SQL.... suggest me ...if he learns SQL SERVER or ORACLE? which is best?

7 Answers   Google, TCS, Unisys,


How can you see what type of locks used?

1 Answers  


How can you list all the columns in a database?

0 Answers  


explain different types of backups avaialabe in sql server? : Sql server database administration

0 Answers  


What is blocking and how would you troubleshoot it? : sql server database administration

0 Answers  


Benefits of Stored Procedures?

0 Answers   Wipro,


Categories