첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

▶ E 메일 주소 검증하기 예제

SELECT dbo.ValidateEMailAddress('icodebroker@naver.com');

 

728x90

 

▶ E 메일 주소 검증하기

CREATE FUNCTION [dbo].[ValidateEMailAddress]
(
    @EMailAddress VARCHAR(255)
)
RETURNS BIT
AS
BEGIN
    RETURN
    (
        SELECT
            CASE
                WHEN @EMailAddress IS NULL                                        THEN 0
                WHEN CHARINDEX(' ', @EMailAddress) <> 0 OR
                     CHARINDEX('/', @EMailAddress) <> 0 OR
                     CHARINDEX(':', @EMailAddress) <> 0 OR
                     CHARINDEX(';', @EMailAddress) <> 0                           THEN 0
                WHEN LEN(@EMailAddress) - 1 <= CHARINDEX('.', @EMailAddress)      THEN 0
                WHEN @EMailAddress LIKE '%@%@%' OR @EMailAddress NOT LIKE '%@%.%' THEN 0
                ELSE                                                                   1
	      END
    );
END
GO
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요