惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cloudbric
Cloudbric
酷 壳 – CoolShell
酷 壳 – CoolShell
人人都是产品经理
人人都是产品经理
G
Google Developers Blog
美团技术团队
MongoDB | Blog
MongoDB | Blog
博客园 - 聂微东
博客园 - Franky
罗磊的独立博客
雷峰网
雷峰网
F
Fortinet All Blogs
Stack Overflow Blog
Stack Overflow Blog
T
The Blog of Author Tim Ferriss
宝玉的分享
宝玉的分享
H
Help Net Security
Vercel News
Vercel News
Last Week in AI
Last Week in AI
Microsoft Security Blog
Microsoft Security Blog
B
Blog
Microsoft Azure Blog
Microsoft Azure Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 叶小钗
Apple Machine Learning Research
Apple Machine Learning Research
L
LangChain Blog
量子位
F
Full Disclosure
Hugging Face - Blog
Hugging Face - Blog
C
Check Point Blog
WordPress大学
WordPress大学
IT之家
IT之家
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recorded Future
Recorded Future
D
Docker
T
Tailwind CSS Blog
博客园 - 司徒正美
博客园 - 三生石上(FineUI控件)
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Blog — PlanetScale
Blog — PlanetScale
阮一峰的网络日志
阮一峰的网络日志
GbyAI
GbyAI
Y
Y Combinator Blog
月光博客
月光博客
aimingoo的专栏
aimingoo的专栏
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Jina AI
Jina AI
Recent Announcements
Recent Announcements
V
Visual Studio Blog
The Cloudflare Blog
P
Proofpoint News Feed

博客园 - roboth

转:“由于代码已经过优化或者本机框架位于调用堆栈之上,无法计算表达式的值”的解决方法 .net tostring format格式说明 - roboth 一、DIP简介(DIP--Dependency Inversion Principle): 请确认 &lt;Import&gt; 声明中的路径正确,且磁盘上存在该文件。 异步委托 Visual Studio 最常用的13个快捷键 H1N1:速饮配方 通过注册表获取文件的ContentType [转]解决ASP.NET Web Applicatio超时时间已到.在操作完成之前超时时间已过或服务器未响应 - roboth 在线创建pdf msdn之sp_xml_preparedocument Route命令使用详解 电子书下载 买药记 抓取图片 xslt之<xsl:apply-templates - roboth - 博客园 盲人摸象 dom操作时机 js小技巧之访问元素属性
sql产生日历表
roboth · 2009-05-15 · via 博客园 - roboth


CREATE TABLE [dbo].[time_dimension] ( 
   
[time_id] [int] IDENTITY (11NOT NULL , 
   
[the_date] [datetime] NULL , 
   
[the_day] [nvarchar] (15NULL , 
   
[the_month] [nvarchar] (15NULL , 
   
[the_year] [smallint] NULL , 
   
[day_of_month] [smallint] NULL , 
   
[week_of_year] [smallint] NULL , 
   
[month_of_year] [smallint] NULL , 
   
[quarter] [nvarchar] (2NULL , 
   
[fiscal_period] [nvarchar] (20NULL 
ON [PRIMARY] DECLARE @WeekString varchar(12), 
@dDate SMALLDATETIME
@sMonth varchar(20), 
@iYear smallint
@iDayOfMonth smallint
@iWeekOfYear smallint
@iMonthOfYear smallint
@sQuarter varchar(2), 
@sSQL varchar(100), 
@adddays int 
   
SELECT @adddays = 1 --日期增量(可以自由设定) 
SELECT @dDate = '01/01/2002' --开始日期 
   
WHILE @dDate < '12/31/2009'  --结束日期 
BEGIN 
   
   
SELECT @WeekString = DATENAME (dw, @dDate
   
SELECT @sMonth=DATENAME(mm,@dDate
   
SELECT @iYear= DATENAME (yy, @dDate
   
SELECT @iDayOfMonth=DATENAME (dd, @dDate
   
SELECT @iWeekOfYear= DATENAME (week, @dDate
   
SELECT @iMonthOfYear=DATEPART(month@dDate
   
SELECT @sQuarter = 'Q' +  CAST(DATENAME (quarter, @dDate)as varchar(1)) 
   
INSERT INTO time_dimension(the_date, the_day, the_month, the_year, 
   day_of_month, 
   week_of_year, month_of_year, quarter) 
VALUES 
   (
@dDate@WeekString@sMonth@iYear@iDayOfMonth@iWeekOfYear
   
@iMonthOfYear@sQuarter
   
SELECT @dDate = @dDate + @adddays 
END 
GO 
select * from