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

推荐订阅源

Attack and Defense Labs
Attack and Defense Labs
T
Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
H
Hackread – Cybersecurity News, Data Breaches, AI and More
I
Intezer
C
Cyber Attacks, Cyber Crime and Cyber Security
The Register - Security
The Register - Security
量子位
Security Latest
Security Latest
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
C
CXSECURITY Database RSS Feed - CXSecurity.com
MyScale Blog
MyScale Blog
J
Java Code Geeks
Apple Machine Learning Research
Apple Machine Learning Research
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
Spread Privacy
Spread Privacy
Jina AI
Jina AI
博客园 - 【当耐特】
P
Palo Alto Networks Blog
Last Week in AI
Last Week in AI
SecWiki News
SecWiki News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
G
GRAHAM CLULEY
宝玉的分享
宝玉的分享
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
The Blog of Author Tim Ferriss
V
Vulnerabilities – Threatpost
有赞技术团队
有赞技术团队
T
Tor Project blog
H
Hacker News: Front Page
A
Arctic Wolf
NISL@THU
NISL@THU
A
About on SuperTechFans
云风的 BLOG
云风的 BLOG
Engineering at Meta
Engineering at Meta
V
V2EX
N
News and Events Feed by Topic
Webroot Blog
Webroot Blog
Know Your Adversary
Know Your Adversary
P
Privacy International News Feed
I
InfoQ
D
Docker
L
LINUX DO - 最新话题
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
U
Unit 42

博客园 - 刀哥道

python 占位符 %s Format odoo 中字段属性对象Field 安装CentOS7.7图解 docker的volumes Docker常用命令详解 Ubuntu修改时区和更新时间 odoo 去除登录页‘数据库管理’和‘由odoo提供支持’字样 Python之虚拟环境virtualenv python三大神器之virtualenv linux下将Python环境默认更改为Python3.6 费曼学习法 Ubuntu修改系统默认编码 如何在Ubuntu 18.04上安装和使用PostgreSQL Bash简介 & Bash是如何处理命令的 ubuntu环境变量的三种设置方法 psql 工具详细使用介绍 使用ubuntu server18.04 搭建odoo12运行环境 Ubuntu修改时区和更新时间 Ubuntu18.04修改apt-get源
SqlServer创建时间维度
刀哥道 · 2020-02-20 · via 博客园 - 刀哥道
DECLARE @BeginDate DATE;

SELECT @BeginDate = '2018-1-1';
WHILE @BeginDate <= '2021-12-31'
BEGIN
INSERT INTO Dim_Date
SELECT Cast(CONVERT(VARCHAR(10), @BeginDate, 112) AS INT) AS DateKey,
       Year(@BeginDate)                                   AS Year,
       Datepart(QUARTER, @BeginDate)                      AS Quarter,
       CASE
         WHEN Datepart(QUARTER, @BeginDate) = 1 THEN '第一季度'
         WHEN Datepart(QUARTER, @BeginDate) = 2 THEN '第二季度'
         WHEN Datepart(QUARTER, @BeginDate) = 3 THEN '第三季度'
         ELSE '第四季度'
       END                                                AS QuarterCN,
       Month(@BeginDate)                                  AS Month,
       CASE
         WHEN Month(@BeginDate) = 1 THEN '一月'
         WHEN Month(@BeginDate) = 2 THEN '二月'
         WHEN Month(@BeginDate) = 3 THEN '三月'
         WHEN Month(@BeginDate) = 4 THEN '四月'
         WHEN Month(@BeginDate) = 5 THEN '五月'
         WHEN Month(@BeginDate) = 6 THEN '六月'
         WHEN Month(@BeginDate) = 7 THEN '七月'
         WHEN Month(@BeginDate) = 8 THEN '八月'
         WHEN Month(@BeginDate) = 9 THEN '九月'
         WHEN Month(@BeginDate) = 10 THEN '10月'
         WHEN Month(@BeginDate) = 11 THEN '11月'
         ELSE '12月'
       END   
                                                    AS MonthCN,
       CASE
         WHEN Datepart(DAY, @BeginDate) <= 10 THEN 1
         WHEN Datepart(DAY, @BeginDate) > 20 THEN 3
         ELSE 2
       END                                                AS Ten,
          CASE
         WHEN Datepart(DAY, @BeginDate) <= 10 THEN '上旬'
         WHEN Datepart(DAY, @BeginDate) > 20 THEN '下旬'
         ELSE '中旬'
       END                                                AS TenCN,
       Datepart(WEEK, @BeginDate) AS Week,
       DATENAME(WeekDay, @BeginDate) AS WeekDay,
       Day(@BeginDate) AS Day,
       CONVERT(VARCHAR(10),@BeginDate,120) AS Date
    SET @BeginDate = DATEADD(DAY,1,@BeginDate);     
 
  END;