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 primary use of the model database?

0 Answers  


Define the one-to-one relationship while designing tables.

0 Answers  


What is built-in function?

0 Answers  


Can we write ddl in trigger?

0 Answers  


What are commit and rollback in sql?

0 Answers  






what are cursors? : Sql server database administration

0 Answers  


What is hot add cpu in sql server 2008?

0 Answers  


Can you name a few encryption mechanisms in sql server?

0 Answers  


What is a trigger in sql server?

0 Answers  


Write query to return all rows sql?

0 Answers  


What's the difference between DELETE TABLE and TRUNCATE TABLE commands?

9 Answers  


what's sql server? : Sql server database administration

0 Answers  


Categories