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
 SQL Server 2000 Forums
 Analysis Services (2000)
 join results of datepart to a string

Author  Topic 

acebassuk
Starting Member

2 Posts

Posted - 2004-09-27 : 09:23:48
Hi

I have a time dimension that I have created quarters in as a level below year, the syntax is

datepart("Q","dbo".DWH_PTime"."Date")

this returns 1 2 3 4 below 2004

I would like it to display

QTR1

etc

can someone please advise me how to precede the datapart function with the string "QTR"

many thanks

Matthew

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-09-27 : 10:24:42
have you tried:

select 'QTR' + cast(datepart(q, dbo.DWH_PTime.Date)) as char(1))

Go with the flow & have fun! Else fight the flow
Go to Top of Page

acebassuk
Starting Member

2 Posts

Posted - 2004-09-28 : 06:28:42
Thanks for that

I tried it and it will not accept it, the error reads "column name not valid"

Matthew

Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-09-28 : 07:48:50
dbo.DWH_PTime.Date is not valid???

show us the query.

Go with the flow & have fun! Else fight the flow
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2004-09-28 : 08:53:34
the problem may not be with the latter part of the query...it may be the former...
i.e. the "select 'QTR'" bit...
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-09-28 : 10:30:55
emmm....why?

Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -