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

Reply via email to