验证日期是否过期

USE [BIWORK_SSIS]
GO
/****** Object: UserDefinedFunction [dbo].[IsDateout] Script Date: 06/15/2015 12:53:30 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER FUNCTION [dbo].[IsDateout](@BDate datetime)
returns nvarchar(20)
AS
BEGIN
DECLARE @myresult nvarchar(20)
IF (datediff(day,@BDate,getdate())>30)
BEGIN
SET @myresult='已过期'
end
else
begin
set @myresult='未到期'
end
RETURN (@myresult)
END

你可能感兴趣的:(日期)