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 a bit datatype?

560


explain different types of joins? : Sql server database administration

529


How to update values in a table with update statements in ms sql server?

550


What is a trace frag? Where do we use it?

669


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.

2310






What is the difference between dataadapter and datareader?

537


Can you tell me some of the common replication dmv's and their use? : sql server replication

533


What is subquery in sql?

566


my name is sejal I have cleared the sbi clerk exam. I am BCA graduate My favorite subject RDBMS Relational database management system. so please send me rRDBMS related interview questions

1532


How to add the custom code in Report?

99


Can sub report data source be different from that of the parent report?

105


How to query multiple tables jointly?

556


How to create a view and a stored procedure in ms sql server using "create view/procedure" statements?

509


what is normalization? Explain different levels of normalization? : Sql server database administration

651


Differentiate between sql temp table vs table variable?

515