22,209
社区成员
发帖
与我相关
我的任务
分享
if patindex('[0-9a-zA-Z]%',@y)<>1 return 23
if patindex('%^[0-9a-zA-Z.-_]%',@y)>0 return 24
if patindex('[0-9a-zA-Z]%',@d)<>1 return 25
if patindex('%^[0-9a-zA-Z.-]%',@d)>0 return 26
if patindex('[0-9a-zA-Z]%',@y)<>1 return 23
if patindex('%[^0-9a-zA-Z.[-[_]%',@y)>0 return 24
if patindex('[0-9a-zA-Z]%',@d)<>1 return 25
if patindex('%[^0-9a-zA-Z.[-]%',@d)>0 return 26
if patindex('[0-9a-zA-Z]%',@y)<>1 return 23
if patindex('%^[0-9a-zA-Z.-_]%',@y)>0 return 24
if patindex('[0-9a-zA-Z]%',@d)<>1 return 25
if patindex('%^[0-9a-zA-Z.-]%',@d)>0 return 26
if patindex('[0-9a-zA-Z]%',@y)<>1 return 23
if patindex('%[^0-9a-zA-Z.[-[_]%',@y)>0 return 24
if patindex('[0-9a-zA-Z]%',@d)<>1 return 25
if patindex('%[^0-9a-zA-Z.[-]%',@d)>0 return 26
create function getemail(@m varchar(8000))
returns int
as
begin
declare @mm varchar(8000),@y varchar(8000),@d varchar(8000)
declare @i int
if @m is null return 21
select @mm = rtrim(ltrim(@m))
select @i = charindex('@',@mm)
if @i < 2 return 22
select @y=right(@mm,@i),@d = left(@mm,len(@mm)-@i)
if patindex('[0-9a-zA-Z]%',@y)<>1 return 23
if patindex('%^[0-9a-zA-Z.-_]%',@y)>0 return 24
if patindex('[0-9a-zA-Z]%',@d)<>1 return 25
if patindex('%^[0-9a-zA-Z.-]%',@d)>0 return 26
if (select count(*) from mail where rtrim(ltrim(mm))=@mm)>1 return 1
return 0
end
go
create table mail(mm varchar(100))
insert mail
select '842234'
union all select 'amen@amenwardy.com'
union all select 'amrit_quilt_centre@hotmail.com '
union all select 'junquett@quadrifoglio.com.br '
union all select 'callas@artshoppe.net '
union all select 'flyingsnow368@yahoo.com.cn '
union all select 'beechworthwine@yahoo.com '
union all select 'beechworthwine@yahoo.com '
union all select 'agroquimlahuerta@prodigy.net.mx '
union all select '863-3015@HANMAIL.NET '
union all select '863-3015@HANMAIL.NET '
union all select '1@profitebor.com '
union all select '1@profitebor.com '
union all select '1@profitebor.com '
union all select '1@profitebor.com '
union all select 'hello world'
union all select 'mini_94@hotmail.com.fernandojc2@hotmail.com.fernandojc2@bigpond.com '
union all select 'clive8116@yahoo.com.vivianbol@hotmail.com'
union all select 'info@homenoffice.com.pk;mozzi@cyber.net.pk'
union all select 'bilalzady@hotmail.com&waji@netvigator.com'
union all select 'jwu@classicpkg.com/jbcindustries@shaw.ca '
union all select 'francisco@leadermagazine.com.br,makeasy@imagelink.com.br '
union all select 'mina_stl@hotmail.comormina_stl@yahoo.com '
union all select 'LPahssen@mn.rr.comorLLPMARK@aol.com '
union all select 'carolt@sharich.com, chugani@sharich.com, sunder@sharich.com '
union all select 'lhysc@ms34.hinet.net;ysclh@hotmail.com '
union all select 'narumon.chaim@paka.com <narumon.chaim@paka.com> '
union all select 'g_naseeb@hotmail.com或 naseeb@emirates.net.ae '
union all select '~~~~ '
union all select '"michael@dfgifts.com" or "john@dfgifts.com" '
union all select '@. '
union all select '-.-@amer.fi '
union all select '#AHMED_ENP@YAHOO.COM '
union all select '//Carol.Taylor@Geest.co.uk '
union all select '-@vega-montage.dk '
union all select 'OFIT@ZAHAV.CO.ILI'
go
set nocount on
select dbo.getemail(mm),* from mail order by dbo.getemail(mm)
go
drop table mail
drop function getemail
/*
mm
----------- ----------------------------------------------------------------------------------------------------
0 agroquimlahuerta@prodigy.net.mx
0 mini_94@hotmail.com.fernandojc2@hotmail.com.fernandojc2@bigpond.com
0 clive8116@yahoo.com.vivianbol@hotmail.com
0 info@homenoffice.com.pk;mozzi@cyber.net.pk
0 bilalzady@hotmail.com&waji@netvigator.com
0 jwu@classicpkg.com/jbcindustries@shaw.ca
0 francisco@leadermagazine.com.br,makeasy@imagelink.com.br
0 mina_stl@hotmail.comormina_stl@yahoo.com
0 LPahssen@mn.rr.comorLLPMARK@aol.com
0 carolt@sharich.com, chugani@sharich.com, sunder@sharich.com
0 lhysc@ms34.hinet.net;ysclh@hotmail.com
0 narumon.chaim@paka.com <narumon.chaim@paka.com>
0 junquett@quadrifoglio.com.br
0 callas@artshoppe.net
0 flyingsnow368@yahoo.com.cn
0 amen@amenwardy.com
0 OFIT@ZAHAV.CO.ILI
1 beechworthwine@yahoo.com
1 beechworthwine@yahoo.com
1 863-3015@HANMAIL.NET
1 863-3015@HANMAIL.NET
1 1@profitebor.com
1 1@profitebor.com
1 1@profitebor.com
1 1@profitebor.com
22 hello world
22 ~~~~
22 842234
22 @.
23 -.-@amer.fi
23 #AHMED_ENP@YAHOO.COM
23 amrit_quilt_centre@hotmail.com
23 g_naseeb@hotmail.com或 naseeb@emirates.net.ae
25 "michael@dfgifts.com" or "john@dfgifts.com"
25 //Carol.Taylor@Geest.co.uk
25 -@vega-montage.dk
*/