Skip to Content
author's profile photo Former Member
Former Member

Creación de Artículos y Clientes

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!!

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Sep 07, 2011 at 05:29 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.