Is it possible to create tables in stored procedures using
a variable for the table name?
Answers were Sorted based on User's Feedback
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 |
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 |
What is the difference between migration and upgradation in sql server?
What is implicit cursors?
What are the new security features added in sql server 2012? : sql server security
Can sql servers link to other servers like oracle?
What is a transaction and why is it important?
Retrieve the unique rows from table without using UNIQUE and DISTINCT keywords.
You have a table with close to 100 million records recently, a huge amount of this data was updated now, various queries against this table have slowed down considerably what is the quickest option to remedy the situation?
What is candidate key with example?
Working with TLogs
Determine when to use stored procedure to complete sql server tasks?
How self join is different from outer join?
I have a table EMP in which the values will be like this EmpId Ename Sal DeptId 11 Ram 10000 10 11 Ram 10000 10 22 Raj 20000 20 22 Raj 20000 20 33 Anil 15000 30 33 Anil 15000 30 I want to delete only duplicate Rows. After Delete I want the output like this EmpId Ename Sal DeptId 11 Ram 10000 10 22 Raj 20000 20 33 Anil 15000 30