Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
/*
exec PADRONES_SEXO_UPDATE_
select updated, count(*) from padrones_sexo_update group by updated
*/
-- =============================================
CREATE OR ALTER PROCEDURE dbo.PADRONES_SEXO_UPDATE_
-- Add the parameters for the stored procedure here
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
DECLARE @cuit varchar(50)
DECLARE @sexo varchar(1)
DECLARE CUITS CURSOR FOR
select padrones_sexo_update.cuit, padrones_sexo_update.sexo
from padrones_sexo_update inner join padrones on
padrones_sexo_update.cuit = padrones.identificacion
where padrones_sexo_update.updated=0 and habilitado = 1
--and isnull(padrones.sexo,'') = ''
open CUITS
FETCH NEXT FROM CUITS INTO @cuit, @sexo
WHILE @@FETCH_STATUS = 0 BEGIN
if((select top 1 isnull(sexo,'') from padrones where identificacion = @cuit and habilitado = 1) = '')
begin
UPDATE padrones SET sexo = @sexo
WHERE identificacion = @cuit
end
update padrones_sexo_update set updated = 1 where cuit = @cuit
FETCH NEXT FROM CUITS INTO @cuit, @sexo
END
CLOSE CUITS
DEALLOCATE CUITS
END
GO
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
/*
exec PADRONES_SEXO_UPDATE_
select updated, count(*) from padrones_sexo_update group by updated
*/
-- =============================================
CREATE OR ALTER PROCEDURE dbo.PADRONES_SEXO_UPDATE_
-- Add the parameters for the stored procedure here
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
DECLARE @cuit varchar(50)
DECLARE @sexo varchar(1)
DECLARE CUITS CURSOR FOR
select padrones_sexo_update.cuit, padrones_sexo_update.sexo
from padrones_sexo_update inner join padrones on
padrones_sexo_update.cuit = padrones.identificacion
where padrones_sexo_update.updated=0 and habilitado = 1
--and isnull(padrones.sexo,'') = ''
open CUITS
FETCH NEXT FROM CUITS INTO @cuit, @sexo
WHILE @@FETCH_STATUS = 0 BEGIN
if((select top 1 isnull(sexo,'') from padrones where identificacion = @cuit and habilitado = 1) = '')
begin
UPDATE padrones SET sexo = @sexo
WHERE identificacion = @cuit
end
update padrones_sexo_update set updated = 1 where cuit = @cuit
FETCH NEXT FROM CUITS INTO @cuit, @sexo
END
CLOSE CUITS
DEALLOCATE CUITS
END
GO
Depends On
2Used By
No items found