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

it indicates that some one had already executed the stored
proc but forgotten to delete the temp table they have
created.

normally before closing that particular transaction within
the SP we need to use drop table statement.

Is This Answer Correct ?    1 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is log shipping? Can we do logshipping with SQL Server 7.0 - Logshipping is a new feature of SQL Server 2000. We should have two SQL Server - Enterprise Editions. From Enterprise Manager we can configure the logshipping. In logshipping the transactional log file from one server is automatically updated into the backup database on the other server. If one server fails, the other server will have the same db and we can use this as the DR (disaster recovery) plan.

2535


Explain about SQL server 2005?

745


How to throw custom exception in Stored Procedure?

764


Explain the various types of concurrency problem. I.e. Lost or buried updates, uncommitted dependency, inconsistent analysis, phantom read?

684


How many types of database relationship in sql server?

755






what are the new features in SSRS?

115


What are data resources?

664


Explain different types of BACKUPs avaialabe in SQL Server? Given a particular scenario, how would you go about choosing a backup plan?

766


What is surrogate key? : sql server analysis services, ssas

867


How will you monitor replication latency in transactional replication? : sql server replication

814


How to integrate the ssrs reports in application?

715


What is hierarchy, what are its types and difference between them? : sql server analysis services, ssas

921


Which sql server is best?

729


What are the encryption mechanisms in sql server?

734


How many ways to create table-valued functions?

752