INSERT statement leaving out rows with null value

  • Crud. I should have read more closely. Good job. Man I feel stupid.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Oh duh, that solves part of the mystery. But ugh, i really don't think we want to mess with the triggers since who knows what side effects that may have and this code is heading for the graveyard this year anyway. Is there a way to turn the trigger off for the transaction? Or, i guess i could try the code in a loop and insert record by record but that will probably be a performance nightmare on a production box.

  • Easiest solution is to drop the trigger on your "new production" or "destination" box and then recreate it after data movement complete.

    James.

  • I am guessing that dropping the trigger on production will not be an option but I'll have to see what my mgr says.

    I did verify that the whole mess works if i put it in a loop and insert one by one, I guess I'll have to see how many of the db tables are designed in this way to know if it's a viable option.

    I still don't understand either why I can manually update the UpdatedBy value, but i guess I'll just chalk it up to bad db design and move on.

    Thanks for your help guys, you've been really helpful.

Viewing 4 posts - 16 through 18 (of 18 total)

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