Multiple Identity Inserts in SQL Server

preview_player
Показать описание
Sometimes you might need to insert data into multiple tables with identity columns. While you might think you can SET IDENTITY_INSERT ON for your tables and be on your merry way, the process is a little more nuanced than that.

Read the full post with examples:

Follow me on Twitter:
Рекомендации по теме
Комментарии
Автор

Dude!!!! Super great catch!! Makes total fricken sense. I was pulling my hair out!!!!

BusaFurian
Автор

Good video. I have run into this but failed to realize it was by session. thank you!

aimeekazmierczak
Автор

Cool video. One question though. In your demo with the stupid questions table, you're using values 1, 1, 2, 3, 4. My assumption is that an identity column is unique. Meaning that this insert should fail because of the values not being unique. As a datawarehouse DBA, having a duplicate in my identity column causes shivers ;) But apparently it is possible to get a duplicate in the identity column?

Reitseschaatser
Автор

I just had to use set identity insert on yesterday a few times. Doesn't happen often for me in data warehouse. I'm sure it happens more in oltp environment.

TheDroc
Автор

People interested in SQL must not know what the like button is. You should have way more likes on your videos. Keep up with the great content.

mooremike
Автор

Have you ever been in Poland? I saw a sticker on your laptop.

kamilawoldan
Автор

Thanks Bert... uhm, SSIS? :)

Thanks for the vid!! Appreciated as always!!

zanonilabuschagne