dbaspot
Tags Register FAQ Calendar Search Today's Posts Mark Forums Read

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. > ...


Home > Database Forum > Microsoft SQL Server > ms-sqlserver > Why does this query fail only SOMETIMES

Reply

 

LinkBack Thread Tools Display Modes
  #11  
Old 04-02-2007, 10:55 AM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: Why does this query fail only SOMETIMES

AC schreef:
> 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
Reply With Quote
Reply

Thread Tools
Display Modes



All times are GMT -4. The time now is 12:36 PM.