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
What is difference between views and tables?
How to rebuild master databse?
How to concatenate two character strings together?
How can you start sql server in different modes?
How to create view in stored procedure sql server?
What is difference between rollback immediate and with no_wait during alter database?
what is the primary use of the model database? : Sql server administration
Why does sql studio use a single registered database repository? : sql server management studio
What is the difference between online clustering and Offline clustering?
What is cdc in sql server?
Explain the microsoft sql server delete command?
what is a sub-report?
How do I port a number to sql server?
How do you implement session management in SQL Server mode?
What is a synonym for manipulation?