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

How do I open a .db file?

490


How are the exceptions handled in sql server programming?

613


What happens if an integer is too big for int date type?

583


What is 3nf normalization?

570


How to select all columns of all rows from a table with a select statement in ms sql server?

582






List all types of constraints in sql server?

520


When would you use an insert into .. Select option versus an insert into .. Values option? Give an example of each?

660


What are the High-Availability solutions in SQL Server and differentiate them briefly?

707


What are different types of data sources?

498


How to use transact-sql statements to access the database engine?

547


How data can be copied from one table to another table?

517


What are pages and extents? : SQL Server Architecture

568


What is temporary stored procedure?

554


What happens if time-only values are provided as date and time literals?

538


Explain iaas, paas and saas?

74