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 |
|
midpenntech
Posting Yak Master
137 Posts |
Posted - 2008-06-26 : 09:09:57
|
| I have a quick question how would i use this expression but have it auto place the current date instead of me having to put in the current date.equipdaily.cnvf00109 * 0.07 * DATEDIFF(d,'6/1/2008', equip.eqprecdt) / 365 AS Interest, DATEDIFF(d, '6/1/2008', equip.eqprecdt) AS DaysThis calculation works I just want to make it automated so I dont have to keep changing the date every month when this report is being run. |
|
|
midpenntech
Posting Yak Master
137 Posts |
Posted - 2008-06-26 : 09:14:03
|
| I did try but got Conversion Failed When Converting Datetime From Character String.equipdaily.cnvf00109 * 0.07 * DATEDIFF(d, 'CDate', equip.eqprecdt) / 365 AS Interest, DATEDIFF(d, 'CDate', equip.eqprecdt)AS Days |
 |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2008-06-26 : 09:14:59
|
| Use getdate() or current_timestampDATEDIFF(d,getdate(), equip.eqprecdt)Jim |
 |
|
|
midpenntech
Posting Yak Master
137 Posts |
Posted - 2008-06-26 : 09:23:19
|
| that part actually worked I think. now for the harder part that goes along with this. under the layout section I have to use this code but wante it to auto date from the Between statement I am useing for time. I currently need to place the dates in manualy.I use a @fromdate and @thurdate but I dont know how to get them to show in this formula seen above=IIF(Fields!eqprecdt.Value< #6/1/2007#,Fields!bookvalue.Value* 0.07,Fields!bookvalue.Value* 0.07 * -1 * datediff("d", #5/31/2008#,Fields!eqprecdt.Value)/365) |
 |
|
|
midpenntech
Posting Yak Master
137 Posts |
Posted - 2008-06-26 : 09:25:24
|
| I dont know if this helps but here is the code that I used for the date range.WHERE (equipdet.gldate BETWEEN @fromdate AND @thrudate) |
 |
|
|
midpenntech
Posting Yak Master
137 Posts |
Posted - 2008-06-26 : 09:41:28
|
| Just figured it out. here is how it workes=sum(IIF(Fields!eqprecdt.Value< Parameters!fromdate.Value,Fields!bookvalue.Value* 0.07,Fields!bookvalue.Value* 0.07 *-1 * datediff("d",Parameters!thrudate.Value,Fields!eqprecdt.Value)/365)) |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-06-26 : 09:46:39
|
| You should post all your Reports related uestions at Reporting Services Forum fro better answersMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|