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
 General SQL Server Forums
 New to SQL Server Administration
 SQL Timing Query
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ahmedpower
Starting Member

Qatar
6 Posts

Posted - 01/03/2013 :  13:53:38  Show Profile  Reply with Quote

HI SQL Team

Please support me to get the data query between particular time as
well the exiting syntax as below

and CTHH.DateTime > DateAdd( mm, DATEDIFF(mm,0,GETDATE()),'1/1/1900')

so please advise how i can use spasific time instead of that above one

Ahmed Soliman

TG
Flowing Fount of Yak Knowledge

USA
6062 Posts

Posted - 01/03/2013 :  14:19:59  Show Profile  Reply with Quote
for all datetimes on a given day one option is:

and <datetimeColumn> >= '2012-01-03'
and <datetimeColumn> < '2012-01-04'

this relies on an implicit conversion from string to datetime. If you want you can make it an explicit conversion with:

and <datetimeColumn> >= convert(datetime, '2012-01-03')
and <datetimeColumn> < convert(datetime, '2012-01-04')

Be One with the Optimizer
TG
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 01/04/2013 :  02:38:21  Show Profile  Reply with Quote
see logic here

http://visakhm.blogspot.in/2012/07/generate-datetime-values-from-integers.html

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

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.06 seconds. Powered By: Snitz Forums 2000