Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
3| Name | Data Type | Length | Description |
|---|---|---|---|
| @id_padron | int | 4 | |
| @id_impuesto | int | 4 | |
| @nro_registro | int | 4 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE OR ALTER PROCEDURE dbo.insertar_impuesto
@id_padron int,
@id_impuesto int,
@nro_registro int
AS
BEGIN
SET NOCOUNT ON;
/*
declare @id int
set @id = (select codigo_impuesto from padron_impuestos where id_padron = @id_padron and codigo_impuesto in(@id_impuesto))
if(@id is null or @id <= 0)
begin
insert into padron_impuestos (id_padron,codigo_impuesto,created_by,visible,created) values (@id_padron,@id_impuesto,0,1,getdate())
end
*/
declare @today date = getdate()
if (@nro_registro = 1)
begin
delete from padron_impuestos where id_padron = @id_padron and convert(date,created) < @today
end
insert into padron_impuestos (id_padron, codigo_impuesto, created_by, visible, created)
values (@id_padron, @id_impuesto, 0, 1, getdate())
END
GO
GO
CREATE OR ALTER PROCEDURE dbo.insertar_impuesto
@id_padron int,
@id_impuesto int,
@nro_registro int
AS
BEGIN
SET NOCOUNT ON;
/*
declare @id int
set @id = (select codigo_impuesto from padron_impuestos where id_padron = @id_padron and codigo_impuesto in(@id_impuesto))
if(@id is null or @id <= 0)
begin
insert into padron_impuestos (id_padron,codigo_impuesto,created_by,visible,created) values (@id_padron,@id_impuesto,0,1,getdate())
end
*/
declare @today date = getdate()
if (@nro_registro = 1)
begin
delete from padron_impuestos where id_padron = @id_padron and convert(date,created) < @today
end
insert into padron_impuestos (id_padron, codigo_impuesto, created_by, visible, created)
values (@id_padron, @id_impuesto, 0, 1, getdate())
END
GO
Depends On
1Used By
No items found