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

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 ()
LVL 1
AFIF JABADOAsked:
Who is Participating?
 
QlemoConnect With a Mentor Batchelor, Developer and EE Topic AdvisorCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.