Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sahu74
Posting Yak Master
100 Posts |
Posted - 2003-10-31 : 10:39:11
|
Hi,I am trying to execute a stored procedure with the following format. I am getting an error : "There is already an object named '#BSBF' in the database."Could you please suggest where I am messing up?Thank you.PKS.DECLARE @DIV as varchar(10)DECLARE @SUBDIV as varchar(10)SET @DIV = 'YA'SET @SUBDIV = 'ZYASA'IF @DIV = ''BEGINSELECT ........INTO #BSBFFROM ........WHERE SubDivisionID LIKE @SubDivDROP TABLE [#BSBF]ENDELSEIF @DIV <>''BEGINSELECT ......INTO #BSBFFROM ......WHERE DivisionID LIKE @DivDROP TABLE [#BSBF]END |
|
|
ehorn
Master Smack Fu Yak Hacker
1632 Posts |
Posted - 2003-10-31 : 10:44:46
|
| You can try creating your #BSBF table prior to condition test and then insert into #BSBF rather than select into |
 |
|
|
sahu74
Posting Yak Master
100 Posts |
Posted - 2003-10-31 : 10:50:42
|
I will give that a try... But what should be the logic for the existing code not to work?PKS.quote: Originally posted by ehorn You can try creating your #BSBF table prior to condition test and then insert into #BSBF rather than select into
|
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2003-10-31 : 11:53:24
|
| You have redundancies in your code:IF DIV = '' xxx ELSE IF DIV <> '' xxxshould be simply:IF DIV = '' xxx ELSE xxxx- Jeff |
 |
|
|
|
|
|