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.
| Author |
Topic |
|
sqlnewbee
Starting Member
4 Posts |
Posted - 2007-11-21 : 18:55:07
|
| I want to setup server time dimension in SQL server 2005 Analysis Services. So I need to add a date column in a fact table which will contain only date part and skip time part of dateime datatype.How can I insert a column in a table which will store only date?Any suggestion with some syntax will be greatly appreciated as I am pretty new in SQL.Thanks in advance |
|
|
dataguru1971
Master Smack Fu Yak Hacker
1464 Posts |
|
|
sqlnewbee
Starting Member
4 Posts |
Posted - 2007-11-22 : 11:55:34
|
| Hello,Thanks for the reply.But still it is containing 12 AM time part which is giving me error in Analysis services.Any idea how to add computed column with datepart function which will add only date part?Thanks! |
 |
|
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2007-11-22 : 15:25:02
|
| The datetime data type contains a date and a time. You can zero out the time, which is what you are doing when you get the time as 12:00AM, but you cannot remove the time from a datetime. If you are getting an error because of the time, then the data type you passing that value to is not expecting a datetime. It sounds like it may be expecting a string that contains a formatted date. If that's what you need then you can use the CONVERT function to convert the datetime into a varchar(10) containing only the date. |
 |
|
|
evilDBA
Posting Yak Master
155 Posts |
Posted - 2007-11-22 : 16:38:09
|
| Hm, I remember in alpha or beta of Yukon I've seen types date, time, and gmtdatetime...It was a long time ago, I am even not sure about it.Interesting, what was a reason to abandon these data types? |
 |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-11-22 : 17:28:00
|
| Not in sql2k5, they are in sql2k8 finally. |
 |
|
|
sqlnewbee
Starting Member
4 Posts |
Posted - 2007-11-22 : 18:43:51
|
| Best thing I found is to create an UDF and use it to add a computed column.Thanks! |
 |
|
|
|
|
|