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
If we delete pack Spec what will be the status of pack Body ?
Explain the truncate command?
What are the different types of collation sensitivity in sql server?
What is a scheduled job or what is a scheduled task?
what are defaults? Is there a column to which a default can't be bound? : Sql server database administration
How much space does sql server 2016 take?
What is the bookmark lookup and rid lookup?
What is in place upgrade in sql server?
What does top operator do?
What is the command used to recompile the stored procedure at run time?
How to define the name and server for a new dsn?
How to use subqueries with the in operators in ms sql server?
How many types of local tables are there in sql server?
How sql server enhances scalability of the database system?
What are transactions in sql?