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
Where is my database stored on the hard disk in ms sql server?
Explain how to integrate the ssrs reports in application?
How do I start sql server agent automatically?
What is user-defined multi-statement table-valued function?
What is a performance monitor?
What program is used to store the data source file?
What does this statement do @@rowcount?
How do I view a script in sql server?
Explain the types of indexes.
How to apply cascading referential integrity in place of triggers?
How to convert numeric expression data types by assignment operations?
Explain view in sql server?
How to create a local temporary stored procedure?
What is a Join and explain its types?
Why I have to use stored procedures?