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 difference between equi join and natural join?

0 Answers  


Why normalization is used?

0 Answers  


Define ACID properties in a Database?

0 Answers   iNautix,


Explain basic SQL queries with SELECT from where Order By, Group By-Having?

3 Answers   TetraSoft, Wipro,


What happens if you add a new index to large table?

0 Answers  






What are group functions in query statements in ms sql server?

0 Answers  


List some advantages and disadvantages of stored procedure?

0 Answers  


can a database be shrunk with users active? : Sql server administration

0 Answers  


Explain different types of index?

0 Answers  


How to provide default values to stored procedure parameters?

0 Answers  


What is replication and database mirroring?

0 Answers  


what is a self join? : Sql server database administration

0 Answers  


Categories