Home Forums SQL Server 7,2000 T-SQL Incorrect syntax near the keyword 'IF'. RE: Incorrect syntax near the keyword 'IF'.

  • You can also move the IF up a line to be before the insert statement. You'll need to add the insert again just below your else.

    IE:

    IF...

    insert...

    select...

    else...

    insert...

    select...

    That said, there's a good chance that isn't going to do what you want it to do. Hard to say without more information. That exists check is suspect.

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]