on 01-31-2017 9:46 PM
Buenas tardes, estoy tratando de hacer una búsqueda formateada para armar un código según el grupo + UDF + consecutivo pero no lo logro, el script que tengo es el siguiente:
declare @type char(2)
set @type= (Select case $[OITM.ItmsGrpCod] when 122 then 'iCF' when 102 then 'GO' when 103 then 'iWA' else '' end)
declare @subgrupo char(2)
set @subgrupo= (Select case $[OITM.U_Codigo] when '101' then 'CH' when '102' then 'CO' else '' end )
Select
@type+@subgrupo+isnull(right(str(max(substring(i.ItemCode,4,3))+001),3),'001') From OITM i
Where
i.ItemCode like @type+'[0-9][0-9][0-9]' AND
i.ItemCode like @subgrupo+'[0-9][0-9][0-9]'
Agradezco la ayuda!
Gracias, pero no cambia el consecutivo.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Oscar,
I have done it for you please try it
Declare @type char (2)
Declare @subgrupo char (2)
SET @type = ''
SET @subgrupo = ''
IF $[OITM.ItmsGrpCod] = 122
SET @type = 'iCF'
IF $[OITM.ItmsGrpCod] = 102
SET @type = 'GO'
IF $[OITM.ItmsGrpCod] = 103
SET @type = 'iWA'
IF $[OITM.U_Code] = '101'
SET @subgrupo = 'CH'
IF $[OITM.U_Code] = '102'
SET @subgrupo = 'CO'
Select
@Type + @subgrupo + isnull (right (str (max (substring (i.ItemCode, 4,3)) + 001), 3), '001') From OITM i
Where
I.ItemCode like @type + '[0-9] [0-9] [0-9]' AND
I.ItemCode like @subgrupo + '[0-9] [0-9] [0-9]'
Thanks
Engr. Taseeb Saeed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.