Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Script Library
 Time dimension

Author  Topic 

rolmau
Starting Member

10 Posts

Posted - 2010-01-04 : 12:28:00
I have time dimension
time_id number,
month
year

I want to add today’s date to the Time dimension

Thanks Guys

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-01-04 : 14:42:15
Is time_id an identity column?
Is number the column to store the day?

Do you mean this?
insert table ([number],[month],[year])
select datepart(dd,getdate()),datepart(month,getdate()),datepart(year,getdate())


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

rolmau
Starting Member

10 Posts

Posted - 2010-01-04 : 15:20:07
Yes Please

time_id PK
month varchar2
year varchar2;

Now if I want ot add today's date in ??

Go to Top of Page

rolmau
Starting Member

10 Posts

Posted - 2010-01-04 : 15:20:38
using insert clause
Go to Top of Page

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2010-01-04 : 15:37:33
Fred just gave you the solution.... didn't he?
quote:
select datepart(dd,getdate()),datepart(month,getdate()),datepart(year,getdate())


Is this not what you want?
Go to Top of Page

rolmau
Starting Member

10 Posts

Posted - 2010-01-04 : 16:06:27
thanks Fred
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-01-04 : 16:54:39
welcome


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -