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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is acid properties?

580


Why use view instead of a table?

509


What is a collation in ms sql server?

541


Explain go command in sql server?

536


How to create percentile function?

108






How can we migrate from SQL server to SQL Azure?

92


How to execute the cursor queries with "open" statements?

604


What is the difference between a "where" clause and a "having" clause?

607


How to create a stored procedure with a statement block in ms sql server?

568


What is similarity and difference between truncate and delete in sql?

579


Name some of the open source software that you can use in alternative to SSR?

105


What is scan table/view and seek table/view when its occurs? : sql server database administration

525


Please differentiate between a local and a global temporary table?

556


Is it true that rules do not apply to data already existing in a database at the time the rule is created?

554


What are the features of Embedded SQL

661