create procedure proc1 (@a int)
as
begin
if @a=1
create table #temp(a1 int)
else
create table #temp(a1 int)
end
while executeing the above code it shows error
like '#temp already exist' .why it shows an error?
Answer Posted / soorai ganesh
Problem in #temp table. Because it comes twice in SP.
(U can say it is in else part. But compiler will not accept
this.First it will compile everthing then running the SP. )
Its better to keep another name for Else part table.......
| Is This Answer Correct ? | 8 Yes | 6 No |
Post New Answer View All Answers
Do you know how to store and query spatial data?
What is a print index?
What is dynamic cursor in SQL SERVER?
What is the fastest way to permanently delete a 1 million row table named customers?
How do I create a trace in sql server?
What is sql server transaction log file?
Why do we backup Active Directory ?
Explain the steps to use transact-sql cursor?
Tell about MOM Tool(Microsoft Operator Manager)?
Define Business Edition in SQL Azure?
What is the function of sql server agent windows service?
What is “begin trans”, “commit tran”, “rollback tran” and “savetran”?
What are the steps to take to improve performance of a poor performing query? : sql server database administration
Difference between uniqe index and uniqe constraint?
how you can list all the tables in a database?