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
How do I create a stored procedure in dbml?
What is partition index in sql server?
What is the sql server 2000 version number?
How many types of triggers in sql server?
How to connect sql server management studio express to sql server 2005 express?
Explain what are magic tables in sql server?
What is sql server management studio? : sql server management studio
How to convert numeric expression data types by assignment operations?
explain different types of cursors? : Sql server database administration
How to delete exactly duplicate records from a table?
Can primary key be a foreign key?
what is an index? : Sql server database administration
What is sub-query in sql server?
What are the different kinds of ssrs reports?
What is cte (common table expression)?