Solved

tsql how to check if datetime between 9:00pm to 10:pm

Posted on 2012-12-25
1
396 Views
Last Modified: 2012-12-25
i want to check if getdate() is between 9:00 pm and 10:00 pm
0
Comment
Question by:afifosh
1 Comment
 
LVL 6

Accepted Solution

by:
Peter Kiprop earned 500 total points
ID: 38719881
Try the below
SELECT  GETDATE() where CONVERT(VARCHAR(8),GETDATE(),108) between '21:00:00' and '22:00:00'

Open in new window


Hope it helps
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question