Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IF ... ELSE Problem
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00450951
Message ID:
00450993
Views:
37
>Larry;
>
>This solves the error but perhaps does not address your requirement.
>
>Use a different name for each table. I used #tmpTable and #tmpTable1 and it worked fine. It would not allow me to use the same tablename in both areas of the conditional statement.
>
>Tom

Tom,
Thanks but as I said, I already have a workaround. The temp table is used as the source of another query later in an SP so I can't use different names unless I want to duplicate code under both branches. Depending on a parameter passed in, the temp table is populated with different data.

I had it as two separate SELECT ... INTO ... Wrong!!! So what I ended up doing was initially create the table using a WHERE 1=0 (.F.) so no records are inserted and then using the INSERT INTO #tmpTable select *what ever here* syntax.

I just want to know why it seems that SQL is not respecting the IF/ELSE syntax when it tries to create the SP. I thought it was just the SEM SP editor but using create procedure from Query Analyzer threw the same error.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Reply
Map
View

Click here to load this message in the networking platform