[sql]代码库
create function test_eamil(@eamil varchar(50))returns int
as
begin
declare @flag int,@t1 varchar(50),@t2 varchar(50),@t3 varchar(50),@t4 varchar(50)
if(charindex('@',@eamil)>0)
	begin
        select @t4=a from dbo.Split(@eamil,'@') where id=1
		select @t1=a from dbo.Split(@eamil,'@') where id=2
		if(charindex('.',@t1)>0 and @t4!='')
			begin
				select @t2=a from dbo.Split(@t1,'.') where id=1
				select @t3=a from dbo.Split(@t1,'.') where id=2
				if(@t2!='' and @t3!='')
					begin
					set @flag=1
					end
				else
					begin
					set @flag=0
					end
			end
		else
			begin
			set @flag=0
			end
    end
else
	begin
		set @flag=0
	end
return @flag
end
go