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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 test if subquery returns a row

Author  Topic 

luke nukem
Starting Member

5 Posts

Posted - 2007-08-03 : 06:48:09
how do i go about testing if my subquery returns a row, it should only return one row or none at all, here's what i've got so far

if exists (Select *
from roomBookings
where bookingID = 1 AND departureDate = @pPrevRowDate)
begin

end

thanks

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-08-03 : 06:51:29

if (Select count(*)
from roomBookings
where bookingID = 1 AND departureDate = @pPrevRowDate)<=1
begin

end


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -