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 can you list all the table constraints in a database?
Indexes are updated automatically is the full-text index also updated automatically?
What is outer join in sql server joins?
What is a trace frag? Where do we use it?
What do you understand by a stored procedure?
What are some examples of schemas?
How to insert data with null values?
Can we call stored procedure in trigger?
Explain the properties of the relational tables?
How to find which stored procedure is currently running in sql server?
Can two tables share the same primary key?
What is the use of =,==,=== operators?
What is an entity-relationship diagram (erd)?
What is the difference between mysql and mysqli?
Can you pass expressions to stored procedure parameters?