356 lines
11 KiB
Transact-SQL
356 lines
11 KiB
Transact-SQL
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE procedure [C6MartPeriodico].[CercaCaratteriAnomali]
|
|
AS
|
|
BEGIN
|
|
declare @num int
|
|
set @num = 1
|
|
CREATE TABLE #tab_temp(
|
|
[Val_Ascii] [smallint] NOT NULL,
|
|
[Val_Char] [varchar](1) NOT NULL,
|
|
[Rete] [varchar](1) NOT NULL,
|
|
[Cod_Fiscale] [varchar](16) NOT NULL,
|
|
[Nome_Campo] [varchar](50) NOT NULL,
|
|
[Val_Campo] [varchar](150) NOT NULL)
|
|
set @num = 1
|
|
while @num < 150
|
|
begin
|
|
insert into #tab_temp
|
|
SELECT ascii(substring(email,@num,1)),
|
|
substring(email,@num,1),
|
|
rete,
|
|
Cod_Fiscale,
|
|
'EMAIL',
|
|
email
|
|
FROM C6MartPeriodico.ContrattoSEI
|
|
WHERE
|
|
ascii(substring(email,@num,len(email))) not between 64 and 90
|
|
and ascii(substring(email,@num,len(email))) not between 97 and 122
|
|
and ascii(substring(email,@num,len(email))) not between 48 and 57
|
|
and ascii(substring(email,@num,len(email))) <> 32
|
|
and ascii(substring(email,@num,len(email))) <> 40
|
|
and ascii(substring(email,@num,len(email))) <> 41
|
|
and ascii(substring(email,@num,len(email))) <> 43
|
|
and ascii(substring(email,@num,len(email))) <> 44
|
|
and ascii(substring(email,@num,len(email))) <> 45
|
|
and ascii(substring(email,@num,len(email))) <> 46
|
|
and ascii(substring(email,@num,len(email))) <> 95
|
|
and ascii(substring(email,@num,len(email))) <> 39
|
|
and ascii(substring(email,@num,len(email))) <> 47
|
|
and ascii(substring(email,@num,len(email))) <> 63
|
|
set @num = @num + 1
|
|
end
|
|
--inizio intervento: 05/02/2015 FCianfa Controllo caratteriAnomali su campi Nome e Cognome della tb c6martperiodico.ANAG_CLIENTI
|
|
set @num = 1
|
|
while @num < 150
|
|
begin
|
|
insert into #tab_temp
|
|
SELECT ascii(substring(Nome+Cognome,@num,1)),
|
|
substring(Nome+Cognome,@num,1),
|
|
rete,
|
|
Cod_Fiscale,
|
|
'Nome+Cognome',
|
|
Nome+Cognome
|
|
FROM C6MartPeriodico.ANAG_CLIENTI
|
|
WHERE
|
|
ascii(substring(Nome+Cognome,@num,len(Nome))) not between 64 and 90
|
|
and ascii(substring(Nome+Cognome,@num,len(Nome))) not between 97 and 122
|
|
and ascii(substring(Nome+Cognome,@num,len(Nome))) not between 48 and 57
|
|
and ascii(substring(Nome+Cognome,@num,len(Nome))) <> 32
|
|
and ascii(substring(Nome+Cognome,@num,len(Nome))) <> 40
|
|
and ascii(substring(Nome+Cognome,@num,len(Nome))) <> 41
|
|
and ascii(substring(Nome+Cognome,@num,len(Nome))) <> 43
|
|
and ascii(substring(Nome+Cognome,@num,len(Nome))) <> 44
|
|
and ascii(substring(Nome+Cognome,@num,len(Nome))) <> 45
|
|
and ascii(substring(Nome+Cognome,@num,len(Nome))) <> 46
|
|
and ascii(substring(Nome+Cognome,@num,len(Nome))) <> 95
|
|
and ascii(substring(Nome+Cognome,@num,len(Nome))) <> 39
|
|
and ascii(substring(Nome+Cognome,@num,len(Nome))) <> 38
|
|
and ascii(substring(Nome+Cognome,@num,len(Nome))) <> 47
|
|
and ascii(substring(Nome+Cognome,@num,len(Nome))) <> 63
|
|
set @num = @num + 1
|
|
end
|
|
--fine intervento: 05/02/2015 FCianfa Controllo caratteriAnomali su campi Nome e Cognome della tb c6martperiodico.ANAG_CLIENTI
|
|
set @num = 1
|
|
while @num < 150
|
|
begin
|
|
insert into #tab_temp
|
|
SELECT ascii(substring(Indirizzo,@num,1)),
|
|
substring(Indirizzo,@num,1),
|
|
rete,
|
|
Cod_Fiscale,
|
|
'INDIRIZZO',
|
|
Indirizzo
|
|
FROM C6MartPeriodico.ContrattoSEI
|
|
WHERE
|
|
ascii(substring(Indirizzo,@num,len(Indirizzo))) not between 64 and 90
|
|
and ascii(substring(Indirizzo,@num,len(Indirizzo))) not between 97 and 122
|
|
and ascii(substring(Indirizzo,@num,len(Indirizzo))) not between 48 and 57
|
|
and ascii(substring(Indirizzo,@num,len(Indirizzo))) <> 32
|
|
and ascii(substring(Indirizzo,@num,len(Indirizzo))) <> 40
|
|
and ascii(substring(Indirizzo,@num,len(Indirizzo))) <> 41
|
|
and ascii(substring(Indirizzo,@num,len(Indirizzo))) <> 43
|
|
and ascii(substring(Indirizzo,@num,len(Indirizzo))) <> 44
|
|
and ascii(substring(Indirizzo,@num,len(Indirizzo))) <> 45
|
|
and ascii(substring(Indirizzo,@num,len(Indirizzo))) <> 46
|
|
and ascii(substring(Indirizzo,@num,len(Indirizzo))) <> 95
|
|
and ascii(substring(Indirizzo,@num,len(Indirizzo))) <> 39
|
|
and ascii(substring(Indirizzo,@num,len(Indirizzo))) <> 47
|
|
and ascii(substring(Indirizzo,@num,len(Indirizzo))) <> 63
|
|
set @num = @num + 1
|
|
end
|
|
set @num = 1
|
|
while @num < 150
|
|
begin
|
|
insert into #tab_temp
|
|
SELECT ascii(substring(CAP,@num,1)),
|
|
substring(CAP,@num,1),
|
|
rete,
|
|
Cod_Fiscale,
|
|
'CAP',
|
|
CAP
|
|
FROM C6MartPeriodico.ContrattoSEI
|
|
WHERE
|
|
ascii(substring(CAP,@num,len(CAP))) not between 64 and 90
|
|
and ascii(substring(CAP,@num,len(CAP))) not between 97 and 122
|
|
and ascii(substring(CAP,@num,len(CAP))) not between 48 and 57
|
|
and ascii(substring(CAP,@num,len(CAP))) <> 32
|
|
and ascii(substring(CAP,@num,len(CAP))) <> 40
|
|
and ascii(substring(CAP,@num,len(CAP))) <> 41
|
|
and ascii(substring(CAP,@num,len(CAP))) <> 43
|
|
and ascii(substring(CAP,@num,len(CAP))) <> 44
|
|
and ascii(substring(CAP,@num,len(CAP))) <> 45
|
|
and ascii(substring(CAP,@num,len(CAP))) <> 46
|
|
and ascii(substring(CAP,@num,len(CAP))) <> 95
|
|
and ascii(substring(CAP,@num,len(CAP))) <> 39
|
|
and ascii(substring(CAP,@num,len(CAP))) <> 47
|
|
and ascii(substring(CAP,@num,len(CAP))) <> 63
|
|
set @num = @num + 1
|
|
end
|
|
set @num = 1
|
|
while @num < 150
|
|
begin
|
|
insert into #tab_temp
|
|
SELECT ascii(substring(Citta,@num,1)),
|
|
substring(Citta,@num,1),
|
|
rete,
|
|
Cod_Fiscale,
|
|
'Citta',
|
|
Citta
|
|
FROM C6MartPeriodico.ContrattoSEI
|
|
WHERE
|
|
ascii(substring(Citta,@num,len(Citta))) not between 64 and 90
|
|
and ascii(substring(Citta,@num,len(Citta))) not between 97 and 122
|
|
and ascii(substring(Citta,@num,len(Citta))) not between 48 and 57
|
|
and ascii(substring(Citta,@num,len(Citta))) <> 32
|
|
and ascii(substring(Citta,@num,len(Citta))) <> 40
|
|
and ascii(substring(Citta,@num,len(Citta))) <> 41
|
|
and ascii(substring(Citta,@num,len(Citta))) <> 43
|
|
and ascii(substring(Citta,@num,len(Citta))) <> 44
|
|
and ascii(substring(Citta,@num,len(Citta))) <> 45
|
|
and ascii(substring(Citta,@num,len(Citta))) <> 46
|
|
and ascii(substring(Citta,@num,len(Citta))) <> 95
|
|
and ascii(substring(Citta,@num,len(Citta))) <> 39
|
|
and ascii(substring(Citta,@num,len(Citta))) <> 47
|
|
and ascii(substring(Citta,@num,len(Citta))) <> 63
|
|
set @num = @num + 1
|
|
end
|
|
set @num = 1
|
|
while @num < 150
|
|
begin
|
|
insert into #tab_temp
|
|
SELECT ascii(substring(Prov,@num,1)),
|
|
substring(Citta,@num,1),
|
|
rete,
|
|
Cod_Fiscale,
|
|
'Prov',
|
|
Prov
|
|
FROM C6MartPeriodico.ContrattoSEI
|
|
WHERE
|
|
ascii(substring(Prov,@num,len(Prov))) not between 64 and 90
|
|
and ascii(substring(Prov,@num,len(Prov))) not between 97 and 122
|
|
and ascii(substring(Prov,@num,len(Prov))) not between 48 and 57
|
|
and ascii(substring(Prov,@num,len(Prov))) <> 32
|
|
and ascii(substring(Prov,@num,len(Prov))) <> 40
|
|
and ascii(substring(Prov,@num,len(Prov))) <> 41
|
|
and ascii(substring(Prov,@num,len(Prov))) <> 43
|
|
and ascii(substring(Prov,@num,len(Prov))) <> 44
|
|
and ascii(substring(Prov,@num,len(Prov))) <> 45
|
|
and ascii(substring(Prov,@num,len(Prov))) <> 46
|
|
and ascii(substring(Prov,@num,len(Prov))) <> 95
|
|
and ascii(substring(Prov,@num,len(Prov))) <> 39
|
|
and ascii(substring(Prov,@num,len(Prov))) <> 47
|
|
and ascii(substring(Prov,@num,len(Prov))) <> 63
|
|
set @num = @num + 1
|
|
end
|
|
set @num = 1
|
|
while @num < 150
|
|
begin
|
|
insert into #tab_temp
|
|
SELECT ascii(substring(Nazione,@num,1)),
|
|
substring(Nazione,@num,1),
|
|
rete,
|
|
Cod_Fiscale,
|
|
'Nazione',
|
|
Nazione
|
|
FROM C6MartPeriodico.ContrattoSEI
|
|
WHERE
|
|
ascii(substring(Nazione,@num,len(Nazione))) not between 64 and 90
|
|
and ascii(substring(Nazione,@num,len(Nazione))) not between 97 and 122
|
|
and ascii(substring(Nazione,@num,len(Nazione))) not between 48 and 57
|
|
and ascii(substring(Nazione,@num,len(Nazione))) <> 32
|
|
and ascii(substring(Nazione,@num,len(Nazione))) <> 40
|
|
and ascii(substring(Nazione,@num,len(Nazione))) <> 41
|
|
and ascii(substring(Nazione,@num,len(Nazione))) <> 43
|
|
and ascii(substring(Nazione,@num,len(Nazione))) <> 44
|
|
and ascii(substring(Nazione,@num,len(Nazione))) <> 45
|
|
and ascii(substring(Nazione,@num,len(Nazione))) <> 46
|
|
and ascii(substring(Nazione,@num,len(Nazione))) <> 95
|
|
and ascii(substring(Nazione,@num,len(Nazione))) <> 39
|
|
and ascii(substring(Nazione,@num,len(Nazione))) <> 47
|
|
and ascii(substring(Nazione,@num,len(Nazione))) <> 63
|
|
set @num = @num + 1
|
|
end
|
|
set @num = 1
|
|
while @num < 150
|
|
begin
|
|
insert into #tab_temp
|
|
SELECT ascii(substring(Presso,@num,1)),
|
|
substring(Presso,@num,1),
|
|
rete,
|
|
Cod_Fiscale,
|
|
'Presso',
|
|
Presso
|
|
FROM C6MartPeriodico.ContrattoSEI
|
|
WHERE
|
|
ascii(substring(Presso,@num,len(Presso))) not between 64 and 90
|
|
and ascii(substring(Presso,@num,len(Presso))) not between 97 and 122
|
|
and ascii(substring(Presso,@num,len(Presso))) not between 48 and 57
|
|
and ascii(substring(Presso,@num,len(Presso))) <> 32
|
|
and ascii(substring(Presso,@num,len(Presso))) <> 40
|
|
and ascii(substring(Presso,@num,len(Presso))) <> 41
|
|
and ascii(substring(Presso,@num,len(Presso))) <> 43
|
|
and ascii(substring(Presso,@num,len(Presso))) <> 44
|
|
and ascii(substring(Presso,@num,len(Presso))) <> 45
|
|
and ascii(substring(Presso,@num,len(Presso))) <> 46
|
|
and ascii(substring(Presso,@num,len(Presso))) <> 95
|
|
and ascii(substring(Presso,@num,len(Presso))) <> 39
|
|
and ascii(substring(Presso,@num,len(Presso))) <> 47
|
|
and ascii(substring(Presso,@num,len(Presso))) <> 63
|
|
set @num = @num + 1
|
|
end
|
|
set @num = 1
|
|
while @num < 150
|
|
begin
|
|
insert into #tab_temp
|
|
SELECT ascii(substring(Rol,@num,1)),
|
|
substring(Rol,@num,1),
|
|
rete,
|
|
Cod_Fiscale,
|
|
'Rol',
|
|
Rol
|
|
FROM C6MartPeriodico.ContrattoSEI
|
|
WHERE
|
|
ascii(substring(Rol,@num,len(Rol))) not between 64 and 90
|
|
and ascii(substring(Rol,@num,len(Rol))) not between 97 and 122
|
|
and ascii(substring(Rol,@num,len(Rol))) not between 48 and 57
|
|
and ascii(substring(Rol,@num,len(Rol))) <> 32
|
|
and ascii(substring(Rol,@num,len(Rol))) <> 40
|
|
and ascii(substring(Rol,@num,len(Rol))) <> 41
|
|
and ascii(substring(Rol,@num,len(Rol))) <> 43
|
|
and ascii(substring(Rol,@num,len(Rol))) <> 44
|
|
and ascii(substring(Rol,@num,len(Rol))) <> 45
|
|
and ascii(substring(Rol,@num,len(Rol))) <> 46
|
|
and ascii(substring(Rol,@num,len(Rol))) <> 95
|
|
and ascii(substring(Rol,@num,len(Rol))) <> 39
|
|
and ascii(substring(Rol,@num,len(Rol))) <> 47
|
|
and ascii(substring(Rol,@num,len(Rol))) <> 63
|
|
set @num = @num + 1
|
|
end
|
|
select distinct * from #tab_temp
|
|
-------------------------------------------------------
|
|
--SELECT * FROM C6MartPeriodico.ContrattoSEI
|
|
--WHERE
|
|
-- Email like '%¿%'
|
|
--OR
|
|
-- Indirizzo like '%¿%'
|
|
--OR
|
|
-- CAP like '%¿%'
|
|
--OR
|
|
-- Citta like '%¿%'
|
|
--OR
|
|
-- Prov like '%¿%'
|
|
--OR
|
|
-- Nazione like '%¿%'
|
|
--OR
|
|
-- Presso like '%¿%'
|
|
--OR
|
|
-- Rol like '%¿%'
|
|
--OR
|
|
-- Email like '%Ç%'
|
|
--OR
|
|
-- Indirizzo like '%Ç%'
|
|
--OR
|
|
-- CAP like '%Ç%'
|
|
--OR
|
|
-- Citta like '%Ç%'
|
|
--OR
|
|
-- Prov like '%Ç%'
|
|
--OR
|
|
-- Nazione like '%Ç%'
|
|
--OR
|
|
-- Presso like '%Ç%'
|
|
--OR
|
|
-- Rol like '%Ç%'
|
|
--OR
|
|
-- Email like '%À%'
|
|
--OR
|
|
-- Indirizzo like '%À%'
|
|
--OR
|
|
-- CAP like '%À%'
|
|
--OR
|
|
-- Citta like '%À%'
|
|
--OR
|
|
-- Prov like '%À%'
|
|
--OR
|
|
-- Nazione like '%À%'
|
|
--OR
|
|
-- Presso like '%À%'
|
|
--OR
|
|
-- Rol like '%À%'
|
|
--OR
|
|
-- Email like '%É%'
|
|
--OR
|
|
-- Indirizzo like '%É%'
|
|
--OR
|
|
-- CAP like '%É%'
|
|
--OR
|
|
-- Citta like '%É%'
|
|
--OR
|
|
-- Prov like '%É%'
|
|
--OR
|
|
-- Nazione like '%É%'
|
|
--OR
|
|
-- Presso like '%É%'
|
|
--OR
|
|
-- Rol like '%É%'
|
|
--OR
|
|
-- Email like '%µ%'
|
|
--OR
|
|
-- Indirizzo like '%µ%'
|
|
--OR
|
|
-- CAP like '%µ%'
|
|
--OR
|
|
-- Citta like '%µ%'
|
|
--OR
|
|
-- Prov like '%µ%'
|
|
--OR
|
|
-- Nazione like '%µ%'
|
|
--OR
|
|
-- Presso like '%µ%'
|
|
--OR
|
|
-- Rol like '%µ%'
|
|
END |