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
How do I start sql server?
What is the benefit of normalization?
What are the different authentication modes in sql server?
What is the maximum size of sql server database?
Where are SQL server users names and passwords are stored in sql server?
How do I delete a sql server database?
How to add the custom code in Report?
How to connect to a sql server using odbc_connect()?
What is table level trigger?
Where the sql logs gets stored? : sql server database administration
What are the differences between substr and charindex in sql server.
How do I view a stored procedure in sql server query?
What is the command used to recompile the stored procedure at run time?
Explain the different index configurations a table can have?
How to create an index on an existing table in ms sql server?