on 05-24-2016 10:30 PM
Hola compañeros!!
Tengo un bloqueo en la creación de artículos pero no se me refleja la descripción del error, sólo me sale el número del error
If @Object_Type = '4' and @transaction_type in ('A','U')
Begin
If (Select 'True' From OITM T0
where (T0.ItemName IS NULL OR T0.ItemName='') and T0.ItemCode=@list_of_cols_val_tab_del)='True'
Begin
Set @error='100'
set @error_message='Descripción obligatoria'
End
End
Saludos
Hola Sara.
La variable @error es de tipo entero:
declare @error int
Su asignación de valores debería ser sin apostrofes:
SET @error = 9
Prueba y nos comentas.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hola Sara, probé tu código sin apostrofes y funciona sin problemas, verifica lo que ya te comenta el compañero Julian.
If @Object_Type = '4' and @transaction_type in ('A','U')
Begin
If (Select 'True' From OITM T0 where (T0.ItemName IS NULL OR T0.ItemName='') and T0.ItemCode=@list_of_cols_val_tab_del)='True'
Begin
Set @error=100
set @error_message='Descripción obligatoria'
End
End
Posiblemente tengas seteada variable algunas líneas más abajo y haya algún problema con algún begin/end de varios que pudieras hacia ando en tu TN.
Prueba quitar los otros candados que tienes y deja solo esto en una base de pruebas, y prueba el escenario que quieres bloquear. Si ya te aparece el mensaje junto con el número de error, entonces si algo está incorrecto líneas más abajo.
Saludos,
JC.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Con este TN te debe de funcionar lo que quieres.
declare @Descripcion numeric
IF @object_type in ('4') AND @transaction_type in ('A','U')
BEGIN
SET @Descripcion=(select COUNT(*) from OITM T0
where where (T0.ItemName IS NULL OR T0.ItemName='') and T0.ItemCode=@list_of_cols_val_tab_del )
IF @Descripcion > 0
BEGIN
SET @error = 4
SET @error_message ='Descripción obligatoria'
END
END
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Valida que al final del TN tenga esto
select @error, @error_message
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
14 | |
10 | |
5 | |
4 | |
3 | |
3 | |
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.