Conflict of operand types: time is incompatible with numeric sqlserver

2

I'm doing a stored procedure to add a sale but I do not have this error Conflict of operand types: time is incompatible with numeric

This Code is the same

CREATE procedure agregarventa(

@idusuario int,
@idcliente int,
@fecha date,
@total decimal (18,2)
)

as 

begin

insert into venta

values (@idusuario,@idcliente,@fecha,@total)

select SCOPE_IDENTITY() as Id

end

This code is the same only that it enters more things and contains the aforementioned error: Conflict of operand types: time is incompatible with numeric

Create procedure agregarventa(

@Idcliente int,
@Idusuario int,
@fechafactura date,
@Horafactura time,
@tipopago nvarchar(50),
@Subtotal numeric (18,2),
@Descuento numeric (18,2),
@totalcordobas numeric(18,2),
@totaldolares numeric(18,2)
)

as 

begin

insert into venta 

values 

(@Idcliente,@Idusuario,@fechafactura,@Horafactura,@tipopago,@Subtotal,@Descuento,@totalcordobas,@totaldolares)

select SCOPE_IDENTITY() as id

end
    
asked by gelder gomez 01.04.2018 в 06:54
source

1 answer

2

It is possible that the order in which the table has its columns is wrong and you are inserting a time value in a numeric, for added security it adds the names of the columns followed by the name of the table.

INSERT INTO 
venta(Idcliente, Idusuario, fechafactura, Horafactura, tipopago, Subtotal, Descuento, totalcordobas, totaldolares) 
VALUES(@Idcliente,@Idusuario,@fechafactura,@Horafactura,@tipopago,@Subtotal,@Descuento,@totalcordobas,@totaldolares).

Share the structure of the table, so that it can help you better.

    
answered by 01.04.2018 / 07:03
source