--计算当前月的实际天数 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'
方法一 代码如下: declare max integer,id integer declare cur_rows cursor local for select 主字段,count(*) from 表名 group by 主字段 having count(*) > 1 open cur_rows fetch cur_rows into id,max while fetch_status=0 begin select max = max -1 set rowcount max delet