| Hi,
Yes we can do in sql also.
{codecitation class="brush: sql; gutter: true;" width="700px"}
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: RRaveen
-- Create date: 04-10-2009
-- Description: Check a date is weekend , if it week end it will return 0 other wise it return the 1.
-- =============================================
CREATE FUNCTION fncIsWeekEndDate
(
-- Add the parameters for the function here
@curDAte datetime
)
RETURNS char(1)
AS
BEGIN
declare @Return char(1)
select @Return = case DateName(weekday,@curDAte)
when 'Sunday'
then '0'
when 'Saturday'
then '0'
else '1'
end
RETURN @Return;
END
GO
{/codecitation}
If anyone have better than this way, Please share with us.
Thank you | |