Will IS NULL work for IF criteria

  • Lynn Pettis (7/29/2009)


    On the other side, to really know what is going on with your code, we would need the DDL for the tables, sample data for the tables, and expected results based on the sample data.

    So, if you still want to know what is going on with this cursor-based solution, please read and following the instructions/guidelines detailed in the first article I have referenced below in my signature block regarding asking for assistance.

    Thanks. I don't want to take it that far. It was just something I was trying to brain tease myself. I agree with John how he said if I learn it too well I might end up using it as a solution. Thanks again to everyone. I can't believe I went two years without ever using this site. I always use to hit the books or google, it's really nice to interact with some of the industries best. I've only done this for two years ever since I got out of college.

  • Iron Chef SQL (7/29/2009)


    for some reason my if condition (to test if NULL then INSERT) inserts data no matter what.

    I'm trying to figure out why but maybe it's something simple and another pair of eyes can see what I can't

    Maybe that's because both segments of your conditional insert data.

    I have to agree with the others that a cursor is not the way to go with this. It's horribly inefficient.

    As I said earlier you should also look at using IF EXISTS or IF NOT EXISTS, unless you're purposely trying to write inefficient code.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 2 posts - 16 through 16 (of 16 total)

You must be logged in to reply to this topic. Login to reply