Solved

tsql how to check if date between 9:00pm-10:00pm from Saturday to Wednesday

Posted on 2012-12-24
1
387 Views
Last Modified: 2013-01-09
i have @messsage i want if it's inserted from date 9:00pm to 10:00pm from saturday to wednesday to
do insert into () value ()
0
Comment
Question by:afifosh
1 Comment
 
LVL 68

Accepted Solution

by:
Qlemo earned 500 total points
Comment Utility
Can you clarify? You want to check if now is between 9pm and 10pm, every day from Sat to Wed, and if so perform an insert?
if (datepart(hh, getdate()) = 21 and datepart(dw, getdate() not between 5 and 6)
    insert into tbl (a, b) select 1, 2

Open in new window

(code is assuming you have US setting of Sunday as start of week).
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now