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 |
jimruddy33
Starting Member
4 Posts |
Posted - 2007-07-12 : 13:12:40
|
if (datalength(cast_varchar([Costpoint].[Profit_Calc_Consolidation].[PD])) = 1)then(0 || cast_varchar([Costpoint].[Profit_Calc_Consolidation].[PD]))else(cast_varchar([Costpoint].[Profit_Calc_Consolidation].[PD])) Goal:To be able to tell the Period number ([PD]) to change from an integer to a var_char so that it can be concatenated with the Fiscal Year. I.e. Fiscal Year || Period number to produce the following results.2006 012006 022006 03Etc…… Status of Problem:The issue is that I can only get it done to the point to where the Fiscal Year || Period number yields the following results:2006120061020061120061220062Etc…. This is as issue since I am trying to get all the information from the past to a certain year and period. Using a filter that says Fiscal Year + Period Number <= ?Prompt_Fiscal_Year? + ?Prompt_Period_Number?So if I enter Year: 2007 Period 3I should get:2006 012006 022006 03Etc…….2006 112006 122007 012007 022007 03 Can you please let me know if my thinking is off or if my SQL is wrong, Thank you for your assistance in this matter. |
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2007-07-12 : 13:48:23
|
Your code does not look like valid Microsoft SQL Server syntax.It also looks like you did not post all of your code.If you are not using Microsoft SQL Server, you should post you question on a site for whatever database you are using.CODO ERGO SUM |
 |
|
X002548
Not Just a Number
15586 Posts |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-07-13 : 00:30:44
|
Post at www.dbforums.comMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|