I would like to build a stored procedure which can return the value 0 or 1 depending if the day of today is in the list of date.
I did something like this :
USE [Alt_db]
GO
/****** Object: StoredProcedure [dbo].[usp_ys] Script Date: 09/05/2012 14:21:18 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[usp_Is_Holyday]
@Value varchar(50),
@Result bit OUTPUT
AS
Begin
If exists (select 1 from Holyday_Date where ISOCNTRYDESC=@Value and Holiday = CURDATE())
set @Result=1
Else
set @Result=0
End
But I have an error syntax.
Do you have any ideas ?
Thanks
For SQL Server, try:
Or for the datepart only:
For SQL Server 2005 or older, use: