Created
August 16, 2017 09:38
-
-
Save hoanbka/ed0aef2ec6dacc317589f08f6583a77f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO black_list.dbo.Block_list_4G | |
SELECT ANI, | |
GETDATE(), | |
0 | |
FROM cskh_hds.dbo.t_Termination_Call_Detail | |
where CallDispositionFlag =1 and DateTime >=dateadd(day,datediff(day,0,GETDATE()),0) | |
and Variable5 is not NULL and AgentPeripheralNumber is not NULL | |
group by ANI having count(ANI) >=10 | |
UNION | |
SELECT CASE | |
WHEN substring(ANI,1,6) ='assist' THEN concat('0',SUBSTRING(ANI,10,len(ANI))) | |
WHEN SUBSTRING(ANI,1,2) = '84' THEN concat('assist-',ANI) | |
WHEN SUBSTRING(ANI,1,1) = '0' THEN concat('84',SUBSTRING(ANI,2,len(ANI))) | |
ELSE '000000' | |
END AS ANI, | |
GETDATE(), | |
0 | |
FROM cskh_hds.dbo.t_Termination_Call_Detail | |
where CallDispositionFlag =1 and DateTime >=dateadd(day,datediff(day,0,GETDATE()),0) | |
and Variable5 is not NULL and AgentPeripheralNumber is not NULL | |
group by ANI having count(ANI) >=10 | |
UNION | |
SELECT CASE | |
WHEN substring(ANI,1,6) ='assist' THEN concat('84',SUBSTRING(ANI,10,len(ANI))) | |
WHEN SUBSTRING(ANI,1,2) = '84' THEN concat('assist-0',SUBSTRING(ANI,2,len(ANI))) | |
WHEN SUBSTRING(ANI,1,1) = '0' THEN concat('assist-',ANI) | |
ELSE '000000' | |
END AS ANI, | |
GETDATE(), | |
0 | |
FROM cskh_hds.dbo.t_Termination_Call_Detail | |
where CallDispositionFlag =1 and DateTime >=dateadd(day,datediff(day,0,GETDATE()),0) | |
and Variable5 is not NULL and AgentPeripheralNumber is not NULL | |
group by ANI having count(ANI) >=10 | |
UNION | |
SELECT CASE | |
WHEN substring(ANI,1,6) ='assist' THEN concat('assist-0',SUBSTRING(ANI,10,len(ANI))) | |
WHEN SUBSTRING(ANI,1,2) = '84' THEN concat('0',substring(ANI,2,len(ANI))) | |
WHEN SUBSTRING(ANI,1,1) = '0' THEN concat('assist-84',SUBSTRING(ANI,2,len(ANI))) | |
ELSE '000000' | |
END AS ANI, | |
GETDATE(), | |
0 | |
FROM cskh_hds.dbo.t_Termination_Call_Detail | |
where CallDispositionFlag =1 and DateTime >=dateadd(day,datediff(day,0,GETDATE()),0) | |
and Variable5 is not NULL and AgentPeripheralNumber is not NULL | |
group by ANI having count(ANI) >=10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO black_list.dbo.Block_list_4G | |
SELECT ANI, | |
GETDATE(), | |
0 | |
FROM cskh_hds.dbo.t_Termination_Call_Detail | |
where CallDispositionFlag =1 and DateTime >=dateadd(day,datediff(day,0,GETDATE()),0) | |
and Variable5 is not NULL and AgentPeripheralNumber is not NULL | |
group by ANI having count(ANI) >=10 | |
UNION | |
SELECT CASE | |
WHEN substring(ANI,1,6) ='assist' THEN concat('0',SUBSTRING(ANI,10,len(ANI))) | |
WHEN SUBSTRING(ANI,1,2) = '84' THEN concat('assist-',ANI) | |
WHEN SUBSTRING(ANI,1,1) = '0' THEN concat('84',SUBSTRING(ANI,2,len(ANI))) | |
ELSE '000000' | |
END AS ANI, | |
GETDATE(), | |
0 | |
FROM cskh_hds.dbo.t_Termination_Call_Detail | |
where CallDispositionFlag =1 and DateTime >=dateadd(day,datediff(day,0,GETDATE()),0) | |
and Variable5 is not NULL and AgentPeripheralNumber is not NULL | |
group by ANI having count(ANI) >=10 | |
UNION | |
SELECT CASE | |
WHEN substring(ANI,1,6) ='assist' THEN concat('84',SUBSTRING(ANI,10,len(ANI))) | |
WHEN SUBSTRING(ANI,1,2) = '84' THEN concat('assist-0',SUBSTRING(ANI,2,len(ANI))) | |
WHEN SUBSTRING(ANI,1,1) = '0' THEN concat('assist-',ANI) | |
ELSE '000000' | |
END AS ANI, | |
GETDATE(), | |
0 | |
FROM cskh_hds.dbo.t_Termination_Call_Detail | |
where CallDispositionFlag =1 and DateTime >=dateadd(day,datediff(day,0,GETDATE()),0) | |
and Variable5 is not NULL and AgentPeripheralNumber is not NULL | |
group by ANI having count(ANI) >=10 | |
UNION | |
SELECT CASE | |
WHEN substring(ANI,1,6) ='assist' THEN concat('assist-0',SUBSTRING(ANI,10,len(ANI))) | |
WHEN SUBSTRING(ANI,1,2) = '84' THEN concat('0',substring(ANI,2,len(ANI))) | |
WHEN SUBSTRING(ANI,1,1) = '0' THEN concat('assist-84',SUBSTRING(ANI,2,len(ANI))) | |
ELSE '000000' | |
END AS ANI, | |
GETDATE(), | |
0 | |
FROM cskh_hds.dbo.t_Termination_Call_Detail | |
where CallDispositionFlag =1 and DateTime >=dateadd(day,datediff(day,0,GETDATE()),0) | |
and Variable5 is not NULL and AgentPeripheralNumber is not NULL | |
group by ANI having count(ANI) >=10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment