Hi,
Why are you passing PM at the end of time. User 24 hour format time.

Try to explore more and convert and cast fuctions in sql.
It may help.

-S

On Sat, Jul 31, 2010 at 11:06 AM, Jeena Ajiesh <[email protected]> wrote:

>  *Dear Friends ,*
> *Thanks for the Replies.*
> *The Date format is in MM/DD/YYYY.*
> *The Datetime which im passing is as 9/2/2010 7:30 PM.*
> *In which date checking is working when i gave the query in between.*
> *But Wen i checked the time between from time and totime. it shows
> nothing.*
> *
>
> Query was: Select message from NetMessage where '7:30:00 PM' between
> FromTime and ToTime.
> From time contain 7:00:00 PM and ToTime contain 8:00:00 PM
> I know this is not the correct way to use the value in query
>
> Any Solutions Pls?
>
> *
>
>   On Fri, Jul 30, 2010 at 5:32 PM, Jamie Fraser <[email protected]>wrote:
>
>> Use a bit of initiative here; take the SQL below, execute it in
>> Management Studio, if it returns nothing then try alternative date
>> formats. This is an extremely simple problem!
>>
>> On Thu, Jul 29, 2010 at 1:43 PM, Jeena Ajiesh <[email protected]> wrote:
>> > Thanks for the reply.
>> > I tried this option, but still no result.
>> >
>> > On Thu, Jul 29, 2010 at 2:57 PM, Jamie Fraser <[email protected]>
>> > wrote:
>> >>
>> >> DECLARE @TargetDate datetime
>> >> SET @TargetDate = '7/29/2010 9:15:00'
>> >>
>> >> SELECT
>> >>     Message
>> >> FROM
>> >>     MyTable
>> >> WHERE
>> >>     FromDate <= @TargetDate
>> >>     AND
>> >>     ToDate >= @TargetDate
>> >>
>> >> On Wed, Jul 28, 2010 at 9:32 AM, Jeena Ajiesh <[email protected]>
>> wrote:
>> >> > Dear friends,
>> >> >
>> >> > im stucked in a problem.
>> >> > in database im having  fromdate,todate, message and id
>> >> > fromdate & todate contains dates with time.
>> >> >
>> >> > Eg in DB:Fromdate
>> >> >   Todate                             Message   Id
>> >> >                  7/25/2010 10:00:00 AM   8/1/2010 12:00:00 PM
>> >> > Test        abc
>> >> >                  7/25/2010 9:00:00 PM      8/1/2010 10:00:00 PM
>> >> > Hello     abc
>> >> >
>> >> > Im passing a date 7/29/2010 9:15:00 PM.So i need to get the message
>> from
>> >> > table as 'Hello'
>> >> >
>> >> > i tried a query SELECT MESSAGE FROM TABLENAME WHERE '7/29/2010
>> 9:15:00
>> >> > PM
>> >> > BETWEEN FROMDATE AND TODATE
>> >> > Can u please help in giving a correct query to retrieve the correct
>> >> > message
>> >> > in DB based on the datetime passing.
>> >> >
>> >> >
>> >> > ***************
>> >> > Thanks & Regards,
>> >> > Jeena Ajiesh
>> >> >
>> >> >
>> >
>> >
>> >
>> > --
>> > ***************
>> > Thanks & Regards,
>> > Jeena Ajiesh
>> > Email: [email protected]
>> >            [email protected]
>> >
>> >
>>
>
>
>
> --
>   ****************
> **Thanks & Regards,
> Jeena Ajiesh
> Email: [email protected]
>            [email protected]*
>
>

Reply via email to