ERROR EN STORE PROCEDURE
Publicado por Eduardo (5 intervenciones) el 18/02/2021 01:08:52
Buenas tardes, espero me puedan ayudar.
Al ejecutar mi store procedure me da el siguiente error Msg 102, Level 15, State 1, Procedure sp_ActualizarCantidadPrecio, Line 14
Incorrect syntax near ','., Me pueden ayudar a identificar el error por favor
Al ejecutar mi store procedure me da el siguiente error Msg 102, Level 15, State 1, Procedure sp_ActualizarCantidadPrecio, Line 14
Incorrect syntax near ','., Me pueden ayudar a identificar el error por favor

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
CREATE PROCEDURE sp_ActualizarCantidadPrecio @n_cantidad DECIMAL(10,2), @n_precio DECIMAL (10,2), @id VARCHAR (50)
AS
BEGIN
DECLARE @nueva_existencia DECIMAL (38,2);
DECLARE @nuevo_total DECIMAL (38,2);
DECLARE @nuevo_precio DECIMAL (38,2);
DECLARE @existencia_actual DECIMAL (38,2);
DECLARE @total_actual DECIMAL (38,2);
DECLARE @precio_actual DECIMAL (38,2);
DECLARE @cantidad_actual DECIMAL (38,2);
DECLARE @pre_actual DECIMAL (38,2);
SELECT cantidad, precio_unitario INTO cantidad_actual,pre_actual FROM Productos WHERE id_producto = id;
SET nueva_existencia = cantidad_actual + n_cantidad;
SET nuevo_total = (cantidad_actual * pre_actual) + (n_cantidad * n_precio);
SET nuevo_precio = nuevo_total / nueva_existencia;
UPDATE Productos SET cantidad = nueva_existencia, precio_unitario = nuevo_precio WHERE id_producto = id;
SELECT nueva_existencia, nuevo_precio;
END
Valora esta pregunta


0