dbo.mp_obtener_productos

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

7
Name Data Type Length Description
@accion varchar 500
@id_producto int 4
@nombre varchar 200
@moneda varchar 5
@valor decimal 9
@picture_path varchar 200
@user_id int 4

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
-- =============================================
-- Author: <Leonel Turchetto>
-- Create date: <24 de Octubre de 2019>
-- =============================================
CREATE OR ALTER PROCEDURE dbo.mp_obtener_productos
@accion varchar(500),
@id_producto int,
@nombre varchar(200),
@moneda varchar(5),
@valor decimal(18,2),
@picture_path varchar(200),
@user_id int

AS

BEGIN
    SET NOCOUNT ON;
 if(@accion = 'obtener_productos_activos')
 begin
  select nombre,moneda,valor,picture_path from mp_productos where activo = 1
 end

 if(@accion = 'insertar_producto')
 begin
  insert into mp_productos
  (nombre,moneda,valor,picture_path,activo,created_by)
  values
  (@nombre,@moneda,@valor,@picture_path,1,@user_id)
 end

 
 if(@accion = 'actualizar_producto_activo')
 begin
  update mp_productos set nombre = @nombre,moneda = @moneda,valor = @valor,picture_path = @picture_path ,modified=getdate(),modified_by=@user_id where id_producto = @id_producto
 end
        
END 

GO

Depends On

1

Used By

No items found