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 |
|
yosiasz
Master Smack Fu Yak Hacker
1635 Posts |
Posted - 2009-04-16 : 17:21:17
|
| Greetings,Based on the following link[url]http://en.wikipedia.org/wiki/Fiscal_year#United_States[/url]How can Get for YEAR(d.Date) AS Fiscal_Year,DATEPART(Quarter, d.Date) AS Fiscal_Quarter,MONTH(d.Date) AS Fiscal_MonthThanks!<><><><><><><><><><><><><><><><><><><><><><><><><>If you don't have the passion to help people, you have no passion |
|
|
kunal.mehta
Yak Posting Veteran
83 Posts |
Posted - 2009-04-17 : 02:25:34
|
Hi,Please provide some test data and output format so that one can help uKUNAL |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-04-17 : 03:33:58
|
[code]DECLARE @Sample TABLE ( dt DATETIME )INSERT @SampleSELECT '20080901' UNION ALLSELECT '20081001' UNION ALLSELECT '20081101' UNION ALLSELECT '20081201' UNION ALLSELECT '20090101' UNION ALLSELECT '20090201' UNION ALLSELECT '20090301' UNION ALLSELECT '20090401' UNION ALLSELECT '20090501' UNION ALLSELECT '20090601' UNION ALLSELECT '20090701' UNION ALLSELECT '20090801' UNION ALLSELECT '20090901' UNION ALLSELECT '20091001' UNION ALLSELECT '20091101' UNION ALLSELECT '20091201'SELECT dt, DATEPART(YEAR, fy) AS Fiscal_Year, DATEPART(QUARTER, fy) AS Fiscal_Quarter, DATEPART(MONTH, fy) AS Fiscal_MonthFROM ( SELECT dt, DATEADD(MONTH, 3, dt) AS fy FROM @Sample ) AS d[/code] E 12°55'05.63"N 56°04'39.26" |
 |
|
|
yosiasz
Master Smack Fu Yak Hacker
1635 Posts |
Posted - 2009-04-17 : 10:32:32
|
| Thanks very much Peso.Sorry I did not provide some data KUNAL .<><><><><><><><><><><><><><><><><><><><><><><><><>If you don't have the passion to help people, you have no passion |
 |
|
|
|
|
|
|
|