本文介绍了如何增加prfix值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 你好@PNO是GP7805然后如何增加 声明 @ PNO varchar ( 50 ) set @ PNO = ' GP90' update PurSettings set GPValue =( select CONVERT ( varchar ,substring( @ PNO , 1 , 2 ))+ convert ( varchar ,( CONVERT ( int ,substring( @ PNO , 3 , 3 ))+ 1 )) 其中 PSettingId =(选择 MAX(PSettingId)来自 PurSettings)) end 解决方案 让我们通过它。有一些好处。 声明@PNO varchar(50) set @PNO ='''GP90'' PRINT @PNO 这很好;在消息窗口中将GP90作为可打印字符串。 - 更新PurSettings - (对我来说没什么意义)声明@GPValue [nvarchar] (MAX) - 甚至没有轻微的自由;必需的赋值 --set GPValue =(选择CONVERT(varchar,substring(@ PNO,1,2))+ convert(varchar,(CONVERT(int,substring(@ PNO,3,3))+ 1) ) --set @ GPValue =(选择CONVERT(varchar,substring(@ PNO,1,2))+ convert(varchar,(CONVERT(int,substring(@ PNO,3,3))+ 1) ) --PRINT @GPValue - 如果没有WHERE就不会发生(但有一个......) 在那个测试中仍然没有好处,所以... SELECT CONVERT(varchar,substring(@ PNO,1,2)) SELECT CONVERT(varchar,substring(@ PNO,1,2) ))+ CONVERT(varchar,(CONVERT(int,SUBSTRING(@ PNO,3,3))+ 1)) 这很好。我只能这是我的工作。返回这些SELECT查询: GP 并且: GP91 现在,我不知道这是什么: - 其中PSettingId =(从PurSettings中选择MAX(PSettingId))) 对于此: - 结束 没有乞求在,所以我怀疑混淆是与WHILE声明。那是'缺失的。所以...更多信息(使用改进解决方案按钮和写入)我们可以继续...... Hi Here @PNO is GP7805 then how to incrementdeclare @PNO varchar(50)set @PNO ='GP90'update PurSettingsset GPValue=(select CONVERT(varchar,substring(@PNO,1,2)) + convert(varchar,(CONVERT(int, substring(@PNO,3,3)) + 1)) where PSettingId=(select MAX(PSettingId) from PurSettings) ) end 解决方案 Let''s work through it. There''s some good.declare @PNO varchar(50)set @PNO =''GP90'' PRINT @PNOThat''s good; get "GP90" as a printable string in the message window.--update PurSettings -- (means nothing to me yet)declare @GPValue [nvarchar](MAX) -- not even slight liberty; required assignment--set GPValue=(select CONVERT(varchar,substring(@PNO,1,2)) + convert(varchar,(CONVERT(int, substring(@PNO,3,3)) + 1))--set @GPValue=(select CONVERT(varchar,substring(@PNO,1,2)) + convert(varchar,(CONVERT(int, substring(@PNO,3,3)) + 1))--PRINT @GPValue -- not going to happen without a WHERE (but there is one ...)Still no good in that test, so ...SELECT CONVERT(varchar,substring(@PNO,1,2))SELECT CONVERT(varchar,substring(@PNO,1,2)) + CONVERT(varchar,(CONVERT(int,SUBSTRING(@PNO,3,3))+1))That''s good. All I can do is work with what I''ve got. The return of these SELECT queries:GPAnd:GP91Now, I don''t know what this is:--where PSettingId=(select MAX(PSettingId) from PurSettings) )And as for this:--endThere''s no "begin", so I suspect the confusion is with a WHILE statement. And that''s missing. So ... more information (use the "Improve Solution" button and an "[Edit]" write-in there) and we can continue ... 这篇关于如何增加prfix值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-28 21:37