How To Create IsWeekday Function In T-SQL To Determine If A Date Is A Weekday Or Weekend



TODO:

Have you ever wanted a function that tells you if a certain date is a Weekday?

 

SOLUTION:

CREATE FUNCTION IsWeekday(@InputDate datetime) RETURNS int
AS
BEGIN
DECLARE @isweekday int

select @isweekday=choose(datepart(dw, @InputDate), 0,1,1,1,1,1,0)

RETURN @isweekday

END

 

NOTES:

There are no notes on this topic