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 / gaurav

Because temp is being used by database internally so that it
is same as a system table so this table can't create by user...

Is This Answer Correct ?    1 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the 3 types of schema?

780


Explain the working of sql privileges?

797


What do you mean by normalisation?

681


what is a live lock? : Sql server database administration

630


How do you test your database? : sql server database administration

713






Differentiate between sql temp table vs table variable?

665


What does it mean to be in union?

673


What is the difference between primary key and unique constraints?

667


You have to store user responses of ‘yes’ and ‘no’ what kind of data type is best suited for this task?

707


What is cursors? And what are the different types of cursor?

739


What is openxml in sql server?

876


Explain throw statement in sql server 2008?

734


Explain Reporting Life Cycle?

102


What is normalization of database? What are its benefits?

680


How to change a login name in ms sql server?

705