on 09-07-2011 5:59 PM
Colegas,
Creé hice un Store Procedure que es el siguiente:
declare @gen as nvarchar(1)
set @gen=(select T0.EDocGenTyp from oinv T0 where T0.DocEntry=@list_of_cols_val_tab_del)
IF @object_type='13' and (@transaction_type='A')
BEGIN
if (select doctotal from oinv where docentry=@list_of_cols_val_tab_del)<=1999 and @gen='G'
begin
set @error=1
set @error_message=' Debes crear factura impresa'
end
END
El Store Procedure funciona bien, Pero cuando quiero crear un artículo o un cliente genera el siguiente error:
[SQL Server Native Client 10.0][SQL Server]Conversion failed when
converting the nvarchar value to data type int. (CINF)
Cuando quito el Store Procedure si deja crear artículos y clientes.
Qué es lo que tengo mal en el Store Procedure??? A qué se debe que no pueda crear artículos y clientes??
Espero que me puedan ayudar.
Saludos!!
Isabel
Eso sucede porque la variable la tienes fuera de la validacion.
SIEMPRE las variables deben declararse despues de las condiciones, porque al declarar la variable fuera, el @list_of_cols_val_tab_del de cualquier transaccion que estes ejecutando en SBO se ira a esa variable.
Cambia tu SP a esta manera
IF @object_type='13' and (@transaction_type='A')
BEGIN
declare @gen as nvarchar(1)
set @gen=(select T0.EDocGenTyp from oinv T0 where T0.DocEntry=@list_of_cols_val_tab_del)
if (select doctotal from oinv where docentry=@list_of_cols_val_tab_del)<=1999 and @gen='G'
begin
set @error=1
set @error_message=' Debes crear factura impresa'
end
END
Saludos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
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.