query not working

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

Im trying to write a query that will select the date of departure for a specific Caravan Inventory no. The dates retrieved must be less than the date specifed by the user (@Prop_arrival_Dt
The problem i am having is that some of the dates retrieved are not less than the date value passed in. This line.....(a.Dt_Of_Departure < @Prop_arrival_dt) does not seem to be working correctly
Does anyone have any idea what i may be doin wrong?

SELECT a.Dt_Of_Departur
FROM dbo.Booking a INNER JOI
dbo.Caravan_Booking b ON a.BookingNo = b.BookingN
WHERE (b.Caravan_Inv_No = @InvNo)
AND (a.Dt_Of_Departure < @Prop_arrival_dt)
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The SQL statement looks OK. I'm assuming this statement is inside a
stored procedure (SP). Therefore:

1. Have you declared the variable to a DateTime?

CREATE PROCEDURE usp_Departures
@Prop_arrival_dt DATETIME,
@InvNo INT
AS
....

2. Are you passing the DateTime value correctly?

exec usp_Departures '2004-2-28', 9876123


MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQEJH6YechKqOuFEgEQKDpQCgtSGGQ3yv6XQP2TVOXNlLpteJPCoAoOuY
4LvEXNtEOAfgRkETIZJ+RPTk
=9krA
-----END PGP SIGNATURE-----
 
Back
Top