Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!
create table DimDate ( DateKey int not null, constraint PK_Date primary key clustered (DateKey) ); go insert into DimDate values (20130601), (20130602), (20130603), (20130604), (20130605), (20130606), (20130607), (20130608), (20130609), (20130610); go create table DimAccount ( AccountKey int not null, constraint PK_Account primary key clustered (AccountKey) ); go insert into DimAccount values (1), (2); go create table FactBalanceChange ( DateKey int not null, AccountKey int not null, Balance money not null, constraint PK_BalanceChange primary key clustered (DateKey, AccountKey), constraint FK_BalanceChange_DateKey foreign key (DateKey) references DimDate(DateKey), constraint FK_BalanceChange_AccountKey foreign key (AccountKey) references DimAccount(AccountKey) ); go insert into FactBalanceChange values (20130601, 1, 10.00), (20130601, 2, 10.00), (20130604, 1, 5.00), (20130607, 2, 5.00), (20130609, 1, 4.00), (20130609, 2, 4.00); go create view FactBalanceSnapshot as select d.DateKey, a.AccountKey, coalesce(c.Balance, lag(c.Balance, 1) over (partition by a.AccountKey order by d.DateKey)) as Balance from DimDate d cross join DimAccount a left outer join FactBalanceChange c on d.DateKey = c.DateKey and a.AccountKey = c.AccountKey; go select * from FactBalanceSnapshot.
|Insert Salary Period that has 2 months||11||22|
|How to use odbc in vb to connect to ms sql||14||38|
|Near realtime alert if SQL Server services stop.||20||56|
|My Query is not giving correct result. Please help||5||30|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
16 Experts available now in Live!