When UPDATE statements DELETE rows!

preview_player
Показать описание
I was shocked to discover that SQL Server was deleting certain rows when I ran an UPDATE statement...or at least that's what I *thought* was happening.

Check out the related blog post for all code samples:

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

I guess it would behave the same way for other columns which are not primary key. The title is misleading though as nothing got deleted

ankushmankar
Автор

Easy mistake to make given the poor column names! Just a bad update statement though, nothing is actually getting deleted!

Sttuey
Автор

lol, I didn't catch that either.

There was one time a couple years ago that I came across a bug in SQL Server. That was the last thing I thought would have happened. It took someone else confirming it was a bug (on stack exchange) before I finally submitted a bug to the SQL Server team. I was a bit flabbergasted that I had find a bug with SQL Server, a rare occurrence!

dovh