Re: Using "like" keyword to return date values ....

Re: Using "like" keyword to return date values ....

 

  

sorry ignore my last mail - with style 120 your date must be of YYYY-MM-DD
format given below -
select createdon from patient
where convert(varchar,createdon,120) like '%2001-11-12%'


----- Original Message -----
From: "Bajal Mohamed" <[Email Address Removed] "LazyDBA.com Discussion" <[Email Address Removed] Monday, June 16, 2003 2:45 PM
Subject: RE: Using "like" keyword to return date values ....


>
> Just to know whether we can use "Like" or not.
>
>
> --- "Lepingwell, Christopher"
> <Christopher.[Email Address Removed] wrote:
> > Why would you want to? What are you trying to
> > achieve here?
> >
> > -----Original Message-----
> > From: Bajal Mohamed [mailto:[Email Address Removed] > Sent: 16 June 2003 10:11
> > To: Lepingwell, Christopher; LazyDBA.com Discussion
> > Subject: RE: Using "like" keyword to return date
> > values ....
> >
> >
> > Yes Guru,
> >
> > Its working.
> >
> > Thanks for everyone replied to my query.
> >
> > But can't we use "like" keyword here?
> >
> >
> > --- "Lepingwell, Christopher"
> > <Christopher.[Email Address Removed] wrote:
> > > Try this:
> > >
> > > Select * From jobs where last_updated between
> > > '20011115' and
> > > dateadd(day,1,'20011115')
> > >
> > > -----Original Message-----
> > > From: Bajal Mohamed [mailto:[Email Address Removed] > > Sent: 16 June 2003 09:59
> > > To: LazyDBA.com Discussion
> > > Subject: RE: Using "like" keyword to return date
> > > values ....
> > >
> > >
> > >
> > > Hi,
> > >
> > > This will display all records > the given date.
> > >
> > > Let as assume i am giving the query as follows;
> > >
> > > select * from jobs where datein >= '10-JUN-2003'
> > >
> > > Then this will return all the jobs from 10th Jun
> > > 2003.
> > >
> > >
> > >
> > > I want to list out all jobs in a particular day
> > > (with
> > > different times).
> > >
> > >
> > > --- Bartholomew Okonkwo <[Email Address Removed] > > wrote:
> > > > ok are u running this from MSSQL Server. i
> > tought
> > > u
> > > > are running from oracle.
> > > >
> > > > am afraid trunc is not an MSSQL function.
> > > >
> > > > why not try
> > > >
> > > > select * from jobs where datein >= '16-JUN-2003'
> >
> > > > THIS WILL DISPLAY YOUR
> > > > ROWS.
> > > >
> > > > HALLO ME BACK ON THE OUTCOME
> > > >
> > > > -----Original Message-----
> > > > From: Bajal Mohamed [mailto:[Email Address Removed] > > > Sent: Monday, June 16, 2003 10:51 AM
> > > > To: Bartholomew Okonkwo; LazyDBA.com Discussion
> > > > Subject: RE: Using "like" keyword to return date
> > > > values ....
> > > >
> > > >
> > > > Hi,
> > > >
> > > > I get the error like this;
> > > >
> > > > Server: Msg 195, Level 15, State 10, Line 1
> > > > 'trunc' is not a recognized function name.
> > > >
> > > >
> > > >
> > > > --- Bartholomew Okonkwo
> > <[Email Address Removed] > > > wrote:
> > > > > PLEASE TRY THIS QUERY
> > > > >
> > > > > select * from jobs where trunc(datein) >=
> > > > > '16-JUN-2003'
> > > > >
> > > > > This will truncate the time stamp and display
> > > the
> > > > 2
> > > > > rows for you.
> > > > >
> > > > >
> > > > > good luck mohamed
> > > > >
> > > > > barth
> > > > > lagos Nigeria
> > > > >
> > > > > -----Original Message-----
> > > > > From: Bajal Mohamed [mailto:[Email Address Removed] > > > > Sent: Monday, June 16, 2003 10:41 AM
> > > > > To: LazyDBA.com Discussion
> > > > > Subject: Using "like" keyword to return date
> > > > values
> > > > > ....
> > > > >
> > > > >
> > > > > Hi Gurus,
> > > > >
> > > > > I have a "datein" column in a table with
> > > datatype
> > > > > Datetime, which stored jobs come in date and
> > > time.
> > > > >
> > > > > I want to list all jobs comes in a day. for
> > this
> > > i
> > > > > used the query given below;
> > > > >
> > > > > Select * from jobs where datein like
> > > '%6/16/2003%'
> > > > >
> > > > > But this query doesn't return any result
> > though
> > > i
> > > > > have
> > > > > jobs comes in today.
> > > > >
> > > > > The datein values are stored as follows;
> > > > >
> > > > > 16-Jun-2003 14:30
> > > > > 16-Jun-2003 16:11
> > > > >
> > > > > from these datas, this query should return 2
> > > rows,
> > > > > but
> > > > > didn't.
> > > > >
> > > > > Advice please.
> > > > >
> > > > > Advanced thanks for your help.
> > > > >
> > > > >
> > > > >
> > > > > =====
> > > > >
> > > > > Best Regards,
> > > > > Bajal Mohamed.
> > > > >
> > > > > Mobile : + 673 + 8611056
> > > > >
> > > > > Time and tide wait for none
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > __________________________________
> > > > > Do you Yahoo!?
> > > > > SBC Yahoo! DSL - Now only $29.95 per month!
> > > > > http://sbc.yahoo.com
> > > > >
> > > > >
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > > TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL,
> > > NOT
> > > > > JUST REPLY
> > > > > To unsubscribe, e-mail:
> > > > > mssqldba-[Email Address Removed] > > > > For additional commands, e-mail:
> > > > > mssqldba-[Email Address Removed] > > > > The Information contained and transmitted by
> > > this
> > > > > E-MAIL is proprietary to
> > > > > Diamond Bank and/or its Customer and is
> > intended
> > > > for
> > > > > use only by the
> > > > > individual or entity to which it is
> > addressed,
> > > > and
> > > > > may contain information
> > > > > that is privileged, confidential or exempt
> > from
> > > a
> > > > > disclosure under
> > > > > applicable law. If this is a forwarded
> > message,
> > > > the
> > > > > content of this E-MAIL
> > > > > may not have been sent with the authority of
> > > the
> > > > > Bank. Diamond Bank shall
> > > > > not be liable for any mails sent without due
> > > > > authorisation or through
> > > > > unauthorised access. If you are not the
> > intended
> > > > > recipient, an agent of the
> > > > > intended recipient or a person responsible for
> > > > > delivering the information to
> > > > > the named recipient, you are notified that any
> > > > use,
> > > > > distribution,
> > > > > transmission, printing, copying or
> > dissemination
> > > > of
> > > > > this information in any
> > > > > way or in any manner is strictly prohibited.
> > > > > If you have received this communication in
> > > error,
> > > > > please delete this mail
> > > > > and notify us immediately at
> > > [Email Address Removed] > > > >
> > > > >
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > > TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL,
> > > NOT
> > > > > JUST REPLY
> > > > > To unsubscribe, e-mail:
> > > > > mssqldba-[Email Address Removed] > > > > For additional commands, e-mail:
> > > > > mssqldba-[Email Address Removed] > > > >
> > > >
> > > >
> > > > =====
> > > >
> > > > Best Regards,
> > > > Bajal Mohamed.
> > > >
> > > > Mobile : + 673 + 8611056
> > > >
> > > > Time and tide wait for none
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > __________________________________
> > > > Do you Yahoo!?
> > > > SBC Yahoo! DSL - Now only $29.95 per month!
> > > > http://sbc.yahoo.com
> > > > The Information contained and transmitted by
> > this
> > > > E-MAIL is proprietary to
> > > > Diamond Bank and/or its Customer and is intended
> > > for
> > > > use only by the
> > > > individual or entity to which it is addressed,
> > > and
> > > > may contain information
> > > > that is privileged, confidential or exempt from
> > a
> > > > disclosure under
> > > > applicable law. If this is a forwarded message,
> > > the
> > > > content of this E-MAIL
> > > > may not have been sent with the authority of
> > the
> > > > Bank. Diamond Bank shall
> > > > not be liable for any mails sent without due
> > > > authorisation or through
> > > > unauthorised access. If you are not the intended
> > > > recipient, an agent of the
> > > > intended recipient or a person responsible for
> > > > delivering the information to
> > > > the named recipient, you are notified that any
> > > use,
> > > > distribution,
> > > > transmission, printing, copying or dissemination
> > > of
> > > > this information in any
> > > > way or in any manner is strictly prohibited.
> > > > If you have received this communication in
> > error,
> > > > please delete this mail
> > > > and notify us immediately at
> > [Email Address Removed] > > >
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL,
> > NOT
> > > > JUST REPLY
> > > > To unsubscribe, e-mail:
> > > > mssqldba-[Email Address Removed] > > > For additional commands, e-mail:
> > > > mssqldba-[Email Address Removed] > > >
> > >
> > >
> > > =====
> > >
> > > Best Regards,
> > > Bajal Mohamed.
> > >
> > > Mobile : + 673 + 8611056
> > >
> > > Time and tide wait for none
> > >
> > >
> > >
> > >
> > >
> > >
> > > __________________________________
> > > Do you Yahoo!?
> > > SBC Yahoo! DSL - Now only $29.95 per month!
> > > http://sbc.yahoo.com
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT
> > > JUST REPLY
> > > To unsubscribe, e-mail:
> > > mssqldba-[Email Address Removed] > > For additional commands, e-mail:
> > > mssqldba-[Email Address Removed] > >
> > >
> >
> ---------------------------------------------------------------------
> > > TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT
> > > JUST REPLY
> > > To unsubscribe, e-mail:
> > > mssqldba-[Email Address Removed] > > For additional commands, e-mail:
> > > mssqldba-[Email Address Removed] > >
> >
> >
> > =====
> >
> > Best Regards,
> > Bajal Mohamed.
> >
> > Mobile : + 673 + 8611056
> >
> > Time and tide wait for none
> >
> >
> >
> >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > SBC Yahoo! DSL - Now only $29.95 per month!
> > http://sbc.yahoo.com
>
>
> =====
>
> Best Regards,
> Bajal Mohamed.
>
> Mobile : + 673 + 8611056
>
> Time and tide wait for none
>
>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
>
> ---------------------------------------------------------------------
> TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
> To unsubscribe, e-mail: mssqldba-[Email Address Removed] For additional commands, e-mail: mssqldba-[Email Address Removed] mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.489 / Virus Database: 288 - Release Date: 6/10/2003

MS Sql Server LazyDBA home page