Skip to content

Commit

Permalink
Make timekey is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
GhazaleZe committed Jan 17, 2021
1 parent 0bb2b0c commit 303a9e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Users.sql
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ begin
insert into DataWarehouse.dbo.U_user_rating_temp([user_id],course_id,course_key,time_key,full_time,rating)
select staging_area.dbo.UserOnlineCourse.[user_id] ,staging_area.dbo.UserOnlineCourse.course_id ,
(select course_key from DataWarehouse.dbo.S_Dim_Course where DataWarehouse.dbo.S_Dim_Course.course_id = staging_area.dbo.UserOnlineCourse.course_id),
(select DataWarehouse.dbo.Make_TimeKey (staging_area.dbo.UserOnlineCourse.datetime_of_rating)) ,staging_area.dbo.UserOnlineCourse.datetime_of_rating , staging_area.dbo.UserOnlineCourse.rating_num
(select DataWarehouse.dbo.S_Make_TimeKey (staging_area.dbo.UserOnlineCourse.datetime_of_rating)) ,staging_area.dbo.UserOnlineCourse.datetime_of_rating , staging_area.dbo.UserOnlineCourse.rating_num
from staging_area.dbo.UserOnlineCourse
where convert(date,staging_area.dbo.UserOnlineCourse.datetime_of_rating)= convert (date,@passing);

Expand Down Expand Up @@ -120,7 +120,7 @@ begin
insert into DataWarehouse.dbo.U_user_rating_temp([user_id],course_id,course_key,time_key,full_time,rating)
select staging_area.dbo.UserOnlineCourse.[user_id] ,staging_area.dbo.UserOnlineCourse.course_id ,
(select course_key from DataWarehouse.dbo.S_Dim_Course where DataWarehouse.dbo.S_Dim_Course.course_id = staging_area.dbo.UserOnlineCourse.course_id),
(select DataWarehouse.dbo.Make_TimeKey (staging_area.dbo.UserOnlineCourse.datetime_of_rating)) ,staging_area.dbo.UserOnlineCourse.datetime_of_rating , staging_area.dbo.UserOnlineCourse.rating_num
(select DataWarehouse.dbo.S_Make_TimeKey (staging_area.dbo.UserOnlineCourse.datetime_of_rating)) ,staging_area.dbo.UserOnlineCourse.datetime_of_rating , staging_area.dbo.UserOnlineCourse.rating_num
from staging_area.dbo.UserOnlineCourse
where convert(date,staging_area.dbo.UserOnlineCourse.datetime_of_rating)= convert (date,@passing);

Expand Down
6 changes: 3 additions & 3 deletions dims.sql
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ GO

exec S_Fill_User_Dim

CREATE Function S_Make_TimeKey (
CREATE Or Alter Function S_Make_TimeKey (
@passdate DATETIME
)
returns nvarchar(255)
Expand Down Expand Up @@ -88,7 +88,7 @@ END
GO

declare @t Datetime;
set @t = (select top 1 FullDateAlternateKey from dbo.Date_Dim);
select dbo.Make_TimeKey (@t)
set @t = (select top 1 FullDateAlternateKey from dbo.S_Dim_Date);
select dbo.S_Make_TimeKey (@t)

select * from Date_Dim

0 comments on commit 303a9e8

Please sign in to comment.