티스토리 뷰
-- Before
SELECT COUNT(1) FROM EMS_AUTO_SCHEDULE_INFO A, EMS_AUTO_SEND_LIST_01 B
WHERE A.WORKDAY = B.WORKDAY AND A.SEQNO = B.SEQNO
AND A.WORKDAY = CONVERT(VARCHAR(8),GETDATE(),112)
AND A.SEND_FLAG = '05' AND A.REQ_DATE < GETDATE()
AND DATEADD(MI,+30,B.REG_DATE) <= GETDATE()
AND B.SEND_TIME IS NULL
AND B.TO_EMAIL IS NOT NULL
AND B.TO_EMAIL <> ''
-- After(이메일 형식 X)
SELECT COUNT(1) FROM EMS_AUTO_SCHEDULE_INFO A, EMS_AUTO_SEND_LIST_01 B
WHERE A.WORKDAY = B.WORKDAY AND A.SEQNO = B.SEQNO
AND A.WORKDAY = CONVERT(VARCHAR(8),GETDATE(),112)
AND A.SEND_FLAG = '05' AND A.REQ_DATE < GETDATE()
AND DATEADD(MI,+30,B.REG_DATE) <= GETDATE()
AND B.SEND_TIME IS NULL
AND B.TO_EMAIL IS NOT NULL
AND B.TO_EMAIL <> ''
AND NOT
(CHARINDEX(' ',LTRIM(RTRIM(B.TO_EMAIL))) = 0
AND LEFT(LTRIM(B.TO_EMAIL),1) <> '@'
AND RIGHT(RTRIM(B.TO_EMAIL),1) <> '.'
AND CHARINDEX('.',B.TO_EMAIL,CHARINDEX('@',B.TO_EMAIL)) - CHARINDEX('@',B.TO_EMAIL) > 1
AND LEN(LTRIM(RTRIM(B.TO_EMAIL))) - LEN(REPLACE(LTRIM(RTRIM(B.TO_EMAIL)),'@','')) = 1
AND CHARINDEX('.',REVERSE(LTRIM(RTRIM(B.TO_EMAIL)))) >= 3
AND (CHARINDEX('.@',B.TO_EMAIL) = 0 AND CHARINDEX('..',B.TO_EMAIL) = 0)
)
-- After(이메일 형식 O)
SELECT COUNT(1) FROM EMS_AUTO_SCHEDULE_INFO A, EMS_AUTO_SEND_LIST_01 B
WHERE A.WORKDAY = B.WORKDAY AND A.SEQNO = B.SEQNO
AND A.WORKDAY = CONVERT(VARCHAR(8),GETDATE(),112)
AND A.SEND_FLAG = '05' AND A.REQ_DATE < GETDATE()
AND DATEADD(MI,+30,B.REG_DATE) <= GETDATE()
AND B.SEND_TIME IS NULL
AND B.TO_EMAIL IS NOT NULL
AND B.TO_EMAIL <> ''
AND
(CHARINDEX(' ',LTRIM(RTRIM(B.TO_EMAIL))) = 0
AND LEFT(LTRIM(B.TO_EMAIL),1) <> '@'
AND RIGHT(RTRIM(B.TO_EMAIL),1) <> '.'
AND CHARINDEX('.',B.TO_EMAIL,CHARINDEX('@',B.TO_EMAIL)) - CHARINDEX('@',B.TO_EMAIL) > 1
AND LEN(LTRIM(RTRIM(B.TO_EMAIL))) - LEN(REPLACE(LTRIM(RTRIM(B.TO_EMAIL)),'@','')) = 1
AND CHARINDEX('.',REVERSE(LTRIM(RTRIM(B.TO_EMAIL)))) >= 3
AND (CHARINDEX('.@',B.TO_EMAIL) = 0 AND CHARINDEX('..',B.TO_EMAIL) = 0)
)
'Database' 카테고리의 다른 글
[MSSQL] 테이블 소유자 변경하기 (0) | 2010.10.27 |
---|---|
[MSSQL] MSSQL2000 DB백업본 복구하기 (0) | 2010.10.09 |
[MSSQL] 날짜 변환 관련 (0) | 2010.09.24 |
[MSSQL] 관리를 위한 쿼리들 (0) | 2010.09.24 |
[ORACLE]OUTER JOIN (0) | 2010.08.26 |
- Total
- Today
- Yesterday
- eclipse
- 데이터
- mssql
- delete
- apache
- table
- Oracle
- Windows
- 테이블
- DATABASE
- MySQL
- select
- Linux
- server
- 파일
- Shell
- 오라클
- 백업
- 서버
- sql
- tomcat
- 설정
- IP
- 리눅스
- 윈도우
- user
- Toad
- java
- 자동차
- DB
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |