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

Can you name some of the dml commands in sql?

648


What are subqueries in sql server?

690


How can you find out if the current user is a member of the specified microsoft® windows nt® group or microsoft sql server™ role?

703


How to provide login information for a new odbc dsn?

615


What is the advantage of sql server?

628






Is INSTEAD OF trigger directly applicable to Table ?

648


Can you edit the .rdl code associated with a linked report?

111


What is the purpose of sql profiler in sql server? : sql server database administration

719


How to get a list of table columns using the "sp_columns" stored procedure in ms sql server?

644


What are the differences between left join and inner join in sql server?

685


Explain the purpose of indexes?

623


What is the most common trace flags used with sql server?

595


What is difference between inner join and join?

602


Comment,Datatypes are unlimited

1722


What are the differences between user defined functions and stored procedures?

622