2012. 10. 26. 14:21
declare
@StartDate datetime = '2010-01-25',
@EndDate datetime = '2010-02-05'
select GETDATE()
select dateadd(day, 10, @StartDate), dateadd(day, -10, @StartDate)
select datediff(day, @StartDate, @EndDate), datediff(month, @StartDate, @EndDate)
select datepart(year,@StartDate), datepart(month,@StartDate) ,datepart(day,@StartDate)
select year(@StartDate), month(@StartDate), day(@StartDate)
2012. 9. 6. 17:58
개행문자 치환쿼리
SELECT delivery_no
, REPLACE(delivery_memo, char(13) + char(10), '\r\n') AS [delivery_memo]
, REPLACE(CONVERT(varchar(MAX), delivery_memo), char(13) + char(10), '<br />') AS [delivery_memo]
FROM delivery_setup
WHERE delivery_no = 9
출처 - 본인