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

How to add an address record into adventureworkslt?

0 Answers  


How raid can influence database performance?

0 Answers  


What is partitioned view?

0 Answers  


What is row_number function?

0 Answers  


How to check table values in sql server?

0 Answers  






What are the types of table?

0 Answers  


How does a profiler work?

0 Answers  


4 Please write a querry to find repeated numbers in the following table. Table Name: Table1 Field1 10 15 20 15 10

7 Answers  


How do I edit a procedure in sql server?

0 Answers  


What are the encryption mechanisms in sql server?

0 Answers  


What is abstracting periodical?

0 Answers  


Explain what is public role in sql server?

0 Answers  


Categories