Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Site Related Forums
 Article Discussion
 Article: How to search for date and time values

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-05-02 : 10:00:39
Georgia submitted "An article written by Bryan Syverson, author of "Murach's SQL for SQL Server.""

Article Link.

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2003-05-02 : 10:38:35
Arnold needs to sit down with Bryan Syverson and show him a few tricks.



Go to Top of Page

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2003-05-02 : 11:41:21
"Date/Time values are approximate numerics"
He seems to be labouring under the delusion that datetime values are stored as floating point values. Which BOL clearly states is not the case. And a little experimentation shows is not the case:

SELECT CAST(SUBSTRING(CAST(GETDATE() AS binary(8)), 1, 4) AS int) AS days,
CAST(SUBSTRING(CAST(GETDATE() AS binary(8)), 5, 4) AS int) AS ticks

 
(Hmm, that's almost identical to Kalen's treatment in Inside SQL Server 2000 p229)

Edit: I'm always forgetting which languages' substring function use start, end and which ones are start, length

Edited by - Arnold Fribble on 05/02/2003 11:57:32
Go to Top of Page

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2003-05-02 : 11:48:38


Go to Top of Page

Bambola
Posting Yak Master

103 Posts

Posted - 2003-05-30 : 04:22:16
I have tried to tell him that a couple of month ago, in response to his article published on SQL Server Central, but he never responded. I guess he didn't make it through my long and exhausting explaination...

Bambola.
Go to Top of Page

dksit_05
Starting Member

3 Posts

Posted - 2008-05-29 : 04:20:54
select convert(varchar(11),getdate,14) from dual
Using this u will get time for the selected date.
Go to Top of Page

dksit_05
Starting Member

3 Posts

Posted - 2008-05-29 : 04:24:02
select convert(varchar(15),getdate(),1) as dt,convert(varchar(15),getdate(),14) as time1

using this u get date and time
Go to Top of Page
   

- Advertisement -