티스토리 뷰

코딩/SQL

SQL 날짜 비교

Raichu 2014.09.26 15:31

어제, 내일 날짜


 

DECLARE @yesterday char(10) = convert(varchar(10),dateadd(d,-1,GETDATE()),121)
DECLARE  @tomorrow char(10) = convert(varchar(10),dateadd(d,+1,GETDATE()),121)
	 WHERE DATE <= CONVERT(CHAR(10), '2014-09-15', 111)

	WHERE DATE >= CONVERT(CHAR(10), GETDATE(),112)


0Feb 22 2006 4:26PMCONVERT(CHAR(19), DATETIME, 0)
102/22/06CONVERT(CHAR(8), DATETIME, 1)
206.02.22CONVERT(CHAR(8), DATETIME, 2)
322/02/06CONVERT(CHAR(8), DATETIME, 3)
422.02.06CONVERT(CHAR(8), DATETIME, 4)
522-02-06CONVERT(CHAR(8), DATETIME, 5)
622 Feb 06CONVERT(CHAR(9), DATETIME, 6)
7Feb 22, 06CONVERT(CHAR(10), DATETIME, 7)
816:26:08CONVERT(CHAR(8), DATETIME, 8)
9Feb 22 2006 4:26:08:020PMCONVERT(CHAR(26), DATETIME, 9)
1002-22-06CONVERT(CHAR(8), DATETIME, 10)
1106/02/22CONVERT(CHAR(8), DATETIME, 11)
12060222CONVERT(CHAR(6), DATETIME, 12)
1322 Feb 2006 16:26:08:020CONVERT(CHAR(24), DATETIME, 13)
1416:26:08:037CONVERT(CHAR(12), DATETIME, 14)
202006-02-22 16:26:08CONVERT(CHAR(19), DATETIME, 20)
212006-02-22 16:26:08.037CONVERT(CHAR(23), DATETIME, 21)
2202/22/06 4:26:08 PMCONVERT(CHAR(20), DATETIME, 22)
232006-02-22CONVERT(CHAR(10), DATETIME, 23)
2416:26:08CONVERT(CHAR(8), DATETIME, 24)
252006-02-22 16:26:08.037CONVERT(CHAR(23), DATETIME, 25)
100Feb 22 2006 4:26PMCONVERT(CHAR(19), DATETIME, 100)
10102/22/2006CONVERT(CHAR(10), DATETIME, 101)
1022006.02.22CONVERT(CHAR(10), DATETIME, 102)
10322/02/2006CONVERT(CHAR(10), DATETIME, 103)
10422.02.2006CONVERT(CHAR(10), DATETIME, 104)
10522-02-2006CONVERT(CHAR(10), DATETIME, 105)
10622 Feb 2006CONVERT(CHAR(11), DATETIME, 106)
107Feb 22, 2006CONVERT(CHAR(12), DATETIME, 107)
10816:26:08CONVERT(CHAR(8), DATETIME, 108)
109Feb 22 2006 4:26:08:067PMCONVERT(CHAR(26), DATETIME, 109)
11002-22-2006CONVERT(CHAR(10), DATETIME, 110)
1112006/02/22CONVERT(CHAR(10), DATETIME, 111)
11220060222CONVERT(CHAR(8), DATETIME, 112)
11322 Feb 2006 16:26:08:067CONVERT(CHAR(24), DATETIME, 113)
11416:26:08:067CONVERT(CHAR(12), DATETIME, 114)
1202006-02-22 16:26:08CONVERT(CHAR(19), DATETIME, 120)
1212006-02-22 16:26:08.080CONVERT(CHAR(23), DATETIME, 121)
1262006-02-22T16:26:08.080CONVERT(CHAR(23), DATETIME, 126)
1272006-02-22T16:26:08.080CONVERT(CHAR(23), DATETIME, 127)
13024 ???? 1427 4:26:08:080PMCONVERT(CHAR(32), DATETIME, 130)
13124/01/1427 4:26:08:080PMCONVERT(CHAR(25), DATETIME, 131)



'코딩 > SQL' 카테고리의 다른 글

MySQL에 원격 접속 허용  (0) 2015.04.24
SQL 테이블 복사  (0) 2014.11.24
SQL 일자별 통계뽑기  (0) 2014.11.17
SQL 프로시저에서 if문 사용법  (0) 2014.09.26
SQL 날짜 비교  (0) 2014.09.26
SQL 빈값 체크  (0) 2014.09.26
댓글
댓글쓰기 폼