[英]SQL Server - Clustered Index Key Issue on FACT Table with millions of rows
[英]Creating a fact table with Date key in SQL Server
我正在第一家数据仓库
我有桌子
fact_xxx(
name,
age,
date_key
)
如何在SQL Server中创建此表?
条件: date_key
始终采用这种格式
select year(getdate()) * 10000 + month(getdate()) * 100 + day(getdate())
每当插入名称,年龄date_key
时,如何创建这样的表?
您可以编写类似这样的函数!
create function Datekey1(@year1 int)
returns int
as
begin
declare @a int= year(@year1) * 10000 + month(@year1) * 100 + day(@year1)
end
return @year1
end;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.