SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Site Related Forums
 Article Discussion
 Article: How to search for date and time values
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

AskSQLTeam
Ask SQLTeam Question

USA
0 Posts

Posted - 05/02/2003 :  10:00:39  Show Profile  Visit AskSQLTeam's Homepage  Reply with Quote
Georgia submitted "An article written by Bryan Syverson, author of "Murach's SQL for SQL Server.""

Article Link.

ValterBorges
Flowing Fount of Yak Knowledge

USA
1429 Posts

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



Go to Top of Page

Arnold Fribble
Yak-finder General

United Kingdom
1961 Posts

Posted - 05/02/2003 :  11:41:21  Show Profile  Reply with Quote
"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
Flowing Fount of Yak Knowledge

USA
1429 Posts

Posted - 05/02/2003 :  11:48:38  Show Profile  Reply with Quote


Go to Top of Page

Bambola
Posting Yak Master

Italy
103 Posts

Posted - 05/30/2003 :  04:22:16  Show Profile  Reply with Quote
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

India
3 Posts

Posted - 05/29/2008 :  04:20:54  Show Profile  Send dksit_05 a Yahoo! Message  Reply with Quote
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

India
3 Posts

Posted - 05/29/2008 :  04:24:02  Show Profile  Send dksit_05 a Yahoo! Message  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000