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 / murthy
The #Temp table created in this stores procedure exists in
memory as long as the Particular session is closed. Hence
drop the table at the end of the procedure.
Note: In case if you exec the SP using Management studio,
close the connection and re-open it, it will work without
modifying anything.
| Is This Answer Correct ? | 1 Yes | 3 No |
Post New Answer View All Answers
What is the maximum size of a row in sql server?
What is the difference between grant and with grant while giving permissions to the user?
what are the new features in SSRS?
Is the primary key column of a table an index in ms sql server?
What is it unwise to create wide clustered index keys?
How to encrypt Strored Procedure in SQL SERVER?
What is the difference between left and right outer join?
What is log shipping? Can we do logshipping with SQL Server 7.0 ?
What are cursors in ms sql server?
What are the difference between primary key and unique key? : sql server database administration
What is deploy, process and build? : sql server analysis services, ssas
What is a heap?
What is purpose of normalization?
Tell me what is the stuff and how does it differ from the replace function?
Can you explain powershell included in sql server 2008?