query not working

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)
 
M

MGFoster

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top