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

yep problem is with the compiler.. I had to think of
another way to solve the problem, eg, I created the #temp
without the IF statement and then used an IF ELSE statement
to modify or update #temp, make sense?

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to download and install the scaled-down database adventureworkslt?

775


How to how to convert numeric expression data types using the convert() function??

722


What is the new security features added in sql server 2014? : sql server security

753


Find nth lowest salary or get nth lowest salary?

791


Explain multiserver query

711






What is normalization and what are the advantages of it?

705


How to deploy the Report?

107


How to check if a table is being used in sql server?

686


Working with TLogs

1599


What is proper subset of candidate key?

760


How to add a new dsn with the odbc driver for sql server?

735


Which are the third-party tools used in sql server and why would you use them?

654


What is advantage data architect?

682


what are cursors? : Sql server database administration

716


Explain intellisense for query editing

756