Why does this query fail only SOMETIMES - ms-sqlserver
This is a discussion on Why does this query fail only SOMETIMES - ms-sqlserver ; AC schreef: > DELETE > FROM PlayerRevisionScores > WHERE RevisionID IN (SELECT RevisionID > FROM Revision > WHERE RevisionDate > RevisionID = @nRev) > AND ClubID = @nClubID) > > Revision Table - Primary Key is RevisionID, an Integer. > ...
![]() |
| | LinkBack | Thread Tools | Display Modes |
|
#11
| |||
| |||
| > DELETE > FROM PlayerRevisionScores > WHERE RevisionID IN (SELECT RevisionID > FROM Revision > WHERE RevisionDate < (SELECT RevisionDate FROM Revision WHERE > RevisionID = @nRev) > AND ClubID = @nClubID) > > Revision Table - Primary Key is RevisionID, an Integer. > > Player Revision Scores, Primary Key is PlayerID and RevisionID. > > Subquery has no shot of returning more than 1 value, as RevisionID is the > PK... > > PlayerRevisionScores has about 14000 rows in the 1 case where it fails, and > while this query doesn't HAVE TO remove all rows, it is, int his > installation, going to remove all 14000 rows most times... However, to > handle all scenarios, the logic in place is accurate. > > The instance where it fails, does the revisiondate in revision happen to be NULL? I've had some weird stuff happening when comparing NULL values. -- Rinze van Huizen C-Services Holland b.v |
![]() |
« Previous Thread
|
Next Thread »
| Thread Tools | |
| Display Modes | |
| |
All times are GMT -4. The time now is 12:36 PM.




Linear Mode