--获得最后添加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))begin Set @InfoNO = substring(@last_InfoNO,1,8) +substring(convert(nvarchar(12),convert(int,'1'+substring(@last_InfoNO,9,4))+1),2,4)endelsebegin Set @InfoNO = convert(nvarchar(8),getdate(),112)+'0001'end
详细解决方案
sql日期添自增长编号的实现
热度:64 发布时间:2016-05-05 14:35:53.0
相关解决方案