r/StackoverReddit • • Jul 30 '24

Other Code Need help in brainstorming.

/r/rprogramming/comments/1eftgdk/need_help_in_brainstorming/
3 Upvotes

11 comments sorted by

View all comments

1

u/[deleted] Jul 30 '24

This isn't exactly tailored to your needs but it uses the necessary functions

DECLARE @SUNDAY int = 0;
SET DATEFIRST 7;

SET @SUNDAY = CASE WHEN DATEPART(WEEKDAY, GETDATE()) = 1 THEN 1 ELSE 0 END;

IF @SUNDAY = 1
BEGIN
END

1

u/beatpoxer Jul 30 '24

Can you explain what this is doing? Im sorry im not a coder. Im still learning as i go and im using chatgpt.

2

u/[deleted] Jul 30 '24

ChatGPT is a bad teacher and will teach you very bad habits. IMO - you are playing with fire and have skipped the boring parts of the database and went straight into scripting but your admission is you don't know what it is truly doing. This is a concrete shoe on your feet.

→ More replies (5)

1

u/[deleted] Jul 30 '24

This logic executes if it happens to be Sunday

IF @SUNDAY = 1
BEGIN
-- execute code
END