--计算当前月的实际天数 Create FUNCTION dbo.CalcDaysOfMonth (@time varchar(6)) RETURNS int AS BEGIN DECLARE @Days int DECLARE @Month int DECLARE @Year int SET @Year=SUBSTRING(@time,1,4) SET @Month=SUBSTRING(@time,5,6) if( @Month='1' OR @Month='3' OR @Month='5'
代码如下:CREATE FUNCTION f_Convert( str NVARCHAR(4000), –要转换的字符串 flag bit –转换标志,0转换成半角,1转换成全角 )RETURNS nvarchar(4000) AS BEGIN DECLARE pat nvarchar(8),step int,i int,spc int IF flag=0 SELECT pat=N’%[!