|
Posted by Dan on 12/02/06 18:38
Hi Hugo
Thanks - i'll take a look
Dan
On Nov 30, 9:13 pm, Hugo Kornelis
<h...@perFact.REMOVETHIS.info.INVALID> wrote:
> On 29 Nov 2006 01:28:49 -0800, Dan wrote:
>
> >I've got a simlar problem - can you post your solution?
> >DanHi Dan,
>
> The best way to solve this is to have a calendar table (seehttp://sqlserver2000.databases.aspfaq.com/why-should-i-consider-using...),
> with FiscalYear as one of it's columns.
>
> Second best is to build a date in string format, using a format that is
> guaranteed to be unabiguous WRT the order of day and month: yyyymmdd.
> For isntance, for a fiscal year that starts on july first:
>
> DECLARE @FiscalYear int
> SET @FiscalYear = 2006
> SELECT something
> FROM sometable
> WHERE TheDate >= CAST(@Year AS varchar) + '0701'
> AND TheDate < CAST(@Year + 1 AS varchar) + '0701'
>
> You might want to read this as well:http://www.karaszi.com/SQLServer/info_datetime.asp
>
> --
> Hugo Kornelis, SQL Server MVP
Navigation:
[Reply to this message]
|