--获得最后添加InfoNO declare @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) end else begin Set @InfoNO = convert(nvarchar(8),getdate(),112)+'0001' end
sql日期加自增长编号的实现
猜你喜欢
转载自itbutteye.iteye.com/blog/1457333
今日推荐
周排行