Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
allan8964
Posting Yak Master
249 Posts |
Posted - 2013-04-06 : 20:03:42
|
Hi there,I try to delete something from a table with statement:delte from Table where code is nullit won't work except statement like this:delte from Table where code is null and ID = 1234How can I check what causes this? |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2013-04-06 : 21:48:24
|
yes it will. you're doing something else wrong...what error are you getting? |
|
|
allan8964
Posting Yak Master
249 Posts |
Posted - 2013-04-06 : 22:29:11
|
I don't have any error msg. Just hangs on, like frozon. I use sp_who2 to check, not found anything blocked. |
|
|
Jeff Moden
Aged Yak Warrior
652 Posts |
Posted - 2013-04-07 : 12:25:20
|
quote: Originally posted by allan8964 I don't have any error msg. Just hangs on, like frozon. I use sp_who2 to check, not found anything blocked.
If the table is large, then it might appear to be frozen due to a full table scan. The criteria you added may have cause an INDEX SEEK which makes it run faster.You might have to put an extra unique index on the table consisting of both the Code and the ID (in that order... the ID will make it unique and much faster as I assume that the ID is the PK).--Jeff Moden RBAR is pronounced "ree-bar" and is a "Modenism" for "Row By Agonizing Row".First step towards the paradigm shift of writing Set Based code:"Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column." When writing schedules, keep the following in mind:"If you want it real bad, that's the way you'll likely get it." |
|
|
|
|
|