sql日期加自增长编号的实现
--获得最后添加InfoNOdeclare @last_InfoNO nvarchar(12) declare cur_findlast scroll cursor for select InfoNO from FeedbackInfos open cur_findlast fetch last from cur_findlast into @last_InfoNO close cur_findlast deallocate cur_findlast --拼接InfoNO declare @InfoNO nvarchar(12)if(convert(nvarchar(8),getdate(),112)=substring(@last_InfoNO,1,8))beginSet @InfoNO = substring(@last_InfoNO,1,8)+substring(convert(nvarchar(12),convert(int,'1'+substring(@last_InfoNO,9,4))+1),2,4)endelsebeginSet @InfoNO = convert(nvarchar(8),getdate(),112)+'0001'end