Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-sqlserver > #1247
| From | Lutz Uhlmann <news@invalid.invalid> |
|---|---|
| Newsgroups | comp.databases.ms-sqlserver |
| Subject | Re: what's going on with datediff function? |
| Date | 2012-09-05 08:22 +0200 |
| Organization | albasani.net |
| Message-ID | <k26r2k$fdj$1@news.albasani.net> (permalink) |
| References | <aa23cac7-3e4f-4b12-83da-562fbc9c5d25@m18g2000yqp.googlegroups.com> |
Am 30.08.2012 21:34, schrieb justaguy: > -- task: find records / rows where createddate is 8/23/2012 > > select * > from myTBL > and datediff(dy,createddate,'8/23/2012') <1 > > -- change parameter from dy to d does not help neither > What's wrong? > > DBMS in question: MS SQL Server 2005 Express Two issues ... 1. Use CONVERT() to make '8/23/2012' a date value 2. Better use the Unseperated String Format (yyyyMMdd hh:mm:ss.ttt) to compare createdate with your value select * from myTBL where createddate>'20120823' select * from myTBL where createddate>'20120823 15:30' http://msdn.microsoft.com/en-us/library/ms187085%28SQL.90%29.aspx Lutz
Back to comp.databases.ms-sqlserver | Previous | Next — Previous in thread | Find similar
what's going on with datediff function? justaguy <lichunshen84@gmail.com> - 2012-08-30 12:34 -0700
Re: what's going on with datediff function? Gene Wirchenko <genew@ocis.net> - 2012-08-30 14:04 -0700
Re: what's going on with datediff function? "Bob Barrows" <reb01501@NOyahooSPAM.com> - 2012-09-04 11:25 -0400
Re: what's going on with datediff function? "Bob Barrows" <reb01501@NOSPAMyahoo.com> - 2012-09-05 18:47 -0400
Re: what's going on with datediff function? rja.carnegie@gmail.com - 2012-09-06 15:53 -0700
Re: what's going on with datediff function? "Bob Barrows" <reb01501@NOSPAMyahoo.com> - 2012-09-06 19:03 -0400
Re: what's going on with datediff function? "Bob Barrows" <reb01501@NOSPAMyahoo.com> - 2012-09-06 19:09 -0400
Re: what's going on with datediff function? Gene Wirchenko <genew@ocis.net> - 2012-09-06 17:20 -0700
Re: what's going on with datediff function? "Bob Barrows" <reb01501@NOSPAMyahoo.com> - 2012-09-05 18:47 -0400
Re: what's going on with datediff function? Lutz Uhlmann <news@invalid.invalid> - 2012-09-05 08:22 +0200
csiph-web