PMFJI, but your version with count(*) wouldn't work because SELECT COUNT(*) always returns result (0 if no records meets condition) so IF EXISTS will always evaluate to True.
It doesn't make a difference if you specify one field or * because query optimizer is smart enough to realize that internal select in EXISTS doesn't retrieve any data but checks if any records for specified conditions exists. IF EXISTS in SQL Server is similar to SEEK in VFP because it doesn't retrive data.
>Hi Mike,
>
>Sorry for the old thread. I was just re-reading it and I have a question:
>
>would it be better to change
>
IF EXISTS (SELECT * FROM cart WHERE cartid = @cartID)
>
>to
IF EXISTS (SELECT count(*) FROM cart WHERE cartid = @cartID)
(or select just one field)
>
>Or this doesn't matter at all for this kind of check?
>
>Thanks a lot in advance.
--sb--