[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 400
  • Last Modified:

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 ()
0
AFIF JABADO
Asked:
AFIF JABADO
1 Solution
 
QlemoDeveloperCommented:
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 Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now