z***y 发帖数: 7151 | | c*******y 发帖数: 8 | 2 厄
尝试一下
SQL Server 2008 Enterprise
declare @YY int;
declare @MM int;
set @YY = 2009;
set @MM = 11;
With CalenderCTE (DayNum,[Date],[WeekDay])
as(
select 1 as DayNum,
CONVERT(datetime,convert(nvarchar(8),@YY * 10000 + @MM * 100 + 1)) [
Date],
DATENAME(WEEKDAY,CONVERT(datetime,convert(nvarchar(8),@YY * 10000 +
@MM * 1
00 + 1))) [WeekDay]
union all
select Day(DATEADD(dd,1,[Date])) as DayNum,
DATEADD(dd,1,[Date]) as [Date],
DATENAME(WEEKDAY,DATE
【在 z***y 的大作中提到】 : http://beyondrelational.com/blogs/tc/archive/2009/11/30/tsql-challenge-18-generate- : text-formatted-month-calendars.aspx
| z***y 发帖数: 7151 | 3 你的code比我的好太多, 我奖给你100个包子.
【在 c*******y 的大作中提到】 : 厄 : 尝试一下 : SQL Server 2008 Enterprise : declare @YY int; : declare @MM int; : set @YY = 2009; : set @MM = 11; : With CalenderCTE (DayNum,[Date],[WeekDay]) : as( : select 1 as DayNum,
| z***y 发帖数: 7151 | 4 if you could tweek your code regarding the collation requirement that would
be
perfect... Your current code is far better than mine...Great work!
【在 c*******y 的大作中提到】 : 厄 : 尝试一下 : SQL Server 2008 Enterprise : declare @YY int; : declare @MM int; : set @YY = 2009; : set @MM = 11; : With CalenderCTE (DayNum,[Date],[WeekDay]) : as( : select 1 as DayNum,
| c*******y 发帖数: 8 | 5 厄,献丑了
谢谢你的包子
年月标题应该挺容易加的吧:)
would
【在 z***y 的大作中提到】 : if you could tweek your code regarding the collation requirement that would : be : perfect... Your current code is far better than mine...Great work!
| i***d 发帖数: 158 | |
|