the script that will enable you to create the new values for each of the measures listed above. The financial year end is 28 February 2011 Then confirm the Financial Year, Quarter, Month, Week and Weekday,please help

  • i am not sure about this statements please help :

    CREATE PROCEDURE FinYear2012

    @Cost_date date = '2011-02-15 00:00:00.0000000'

    AS

    BEGIN

    DECLARE @Fin_year int

    DECLARE @Fin_quarter int

    DECLARE @fin_Month int

    DECLARE @Fin_Week int

    DECLARE @Weekday Varchar (25)

    SELECT

    Mydate

    , CASE

    WHEN (Mydate) BETWEEN '2010-02-28 ' AND '2010-05-28 ' THEN 'First Quarter'

    WHEN (Mydate) BETWEEN '2010-05-28 ' AND '2010-08-28 ' THEN 'Second Quarter'

    WHEN (Mydate) BETWEEN '2010-08-28 ' AND '2010-12-28 ' THEN 'Third Quarter'

    WHEN (Mydate) BETWEEN '2010-12-28 ' AND '2011-02-28 ' THEN 'Fourth Quarter'

    END AS FiscalYear

    FROM Transactions

    set @Fin_year = DATEDIFF(year, '2010-02-28 23:59:59.9999999'

    , '2011-02-28 00:00:00.0000000');

    set @Fin_quarter = DATEDIFF(quarter, '2010-02-28 23:59:59.9999999'

    , '2011-02-28 00:00:00.0000000');

    set @fin_Month = DATEDIFF(MONTH, '2010-02-28 23:59:59.9999999'

    , '2011-02-28 00:00:00.0000000');

    set @Fin_Week = DATEDIFF(WEEK, '2010-02-28 23:59:59.9999999'

    , '2011-02-28 00:00:00.0000000');

    set @Weekday = DATEDIFF(WEEKDAY, '2010-02-28 23:59:59.9999999'

    , '2011-02-28 00:00:00.0000000');

    SELECT @Fin_year as FinancialYr ,@Fin_quarter as FinancialQtr , @fin_Month as FinancialMnth , @Weekday as Wekkeday

    END

    GO

    😀

  • Please stop spamming the forum!

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply