|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Include milliseconds in time literal in SQL?Hi,
in a datetime field in a database, the date/time value is 11/21/2005 09:30:45.753. The interesting part is the seconds. It's 45.753 seconds. How do I query for this exact value? Maximum resolution seems to be seconds: "...where value=#21/11/2005 09:30:45#" This is not allowed: "...where value=#21/11/2005 09:30:45.753# This not, too: "...where value=#21/11/2005 09:30:45:753# So, how do I include the milliseconds in a time literal in an SQL? Armin Use parameters instead (SqlParameter).
-- Show quoteMiha Markic [MVP C#] RightHand .NET consulting & development www.rthand.com Blog: http://cs.rthand.com/blogs/blog_with_righthand/ "Armin Zingler" <az.nospam@freenet.de> wrote in message news:%23uUsBvn7FHA.808@TK2MSFTNGP09.phx.gbl... > Hi, > > in a datetime field in a database, the date/time value is > 11/21/2005 09:30:45.753. The interesting part is the seconds. It's 45.753 > seconds. How do I query for this exact value? Maximum resolution seems to > be > seconds: "...where value=#21/11/2005 09:30:45#" > This is not allowed: "...where value=#21/11/2005 09:30:45.753# > This not, too: "...where value=#21/11/2005 09:30:45:753# > > So, how do I include the milliseconds in a time literal in an SQL? > > > Armin > "Miha Markic [MVP C#]" <miha at rthand com> schrieb Possible, but I'm interested in how to do it on my own.> Use parameters instead (SqlParameter). Armin SELECT * FROM TABLE
WHERE VALUE='2005-11-21 07:05:07.810' -- Show quoteGregory A. Beamer MVP; MCP: +I, SE, SD, DBA *********************************************** Think Outside the Box! *********************************************** "Armin Zingler" <az.nospam@freenet.de> wrote in message news:%23uUsBvn7FHA.808@TK2MSFTNGP09.phx.gbl... > Hi, > > in a datetime field in a database, the date/time value is > 11/21/2005 09:30:45.753. The interesting part is the seconds. It's 45.753 > seconds. How do I query for this exact value? Maximum resolution seems to > be > seconds: "...where value=#21/11/2005 09:30:45#" > This is not allowed: "...where value=#21/11/2005 09:30:45.753# > This not, too: "...where value=#21/11/2005 09:30:45:753# > > So, how do I include the milliseconds in a time literal in an SQL? > > > Armin > "Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@comcast.netNoSpamM> schrieb This is not a valid date/time format. Date/time literals must be enclosed in> SELECT * FROM TABLE > WHERE VALUE='2005-11-21 07:05:07.810' '#'. The ''' indicates a string, thus I get a data type mismatch error. Armin Armin,
You know that your litterals are wrong, you use European standard, the literarls are in the current versions still all based on USA notation. (and therefore I don't like them, gives me to much confusion) Just to bring your attention on. Cor "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> schrieb You're right. I mistyped in the posting only. Must have been > Armin, > > You know that your litterals are wrong, you use European standard, > the literarls are in the current versions still all based on USA > notation. > > (and therefore I don't like them, gives me to much confusion) > > Just to bring your attention on. 11/21/2005 of course. Thanks! Armin |
|||||||||||||||||||||||