날짜 조회 쿼리
SELECT CONVERT(CHAR(10),DATEADD(d,number,'2012-01-01'),120) dt,
DATENAME(dw,DATEADD(d,number,'2012-01-01')) dn,
DATEPART(dw,DATEADD(d,number,'2012-01-01')) dp
FROM MASTER..SPT_VALUES
WHERE TYPE = 'P' AND number <= DATEDIFF(d,'2012-01-01','2013-12-31')
DATENAME(dw,DATEADD(d,number,'2012-01-01')) dn,
DATEPART(dw,DATEADD(d,number,'2012-01-01')) dp
FROM MASTER..SPT_VALUES
WHERE TYPE = 'P' AND number <= DATEDIFF(d,'2012-01-01','2013-12-31')
행복한 고수되셔요~
woojja ))*
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
반응형
'DATABASE > MS SQL' 카테고리의 다른 글
[MS SQL] Replace Value (0) | 2020.11.30 |
---|---|
[MS SQL] Stored Procedure 에서 Return Value 를 처리하기 (0) | 2014.09.23 |
[MS SQL] MS SQL Server 2005를 설치하다가 이런 메시지를 받았다면.... (0) | 2010.03.19 |
[MS SQL] Vista 나 Windows2008 Server 에서 Error 1075 번 에러를 만났다면... (0) | 2010.03.19 |
[MS SQL] SQL Server 2000 성능 데이터 보기 (0) | 2009.12.15 |