Function for Getting Interval Dates by days,months,years.

  • bhavin.gala05

    SSC Rookie

    Points: 42

    Comments posted to this topic are about the item Function for Getting Interval Dates by days,months,years.

  • akljfhnlaflkj

    SSC Guru

    Points: 76202

    Quite elaborate, thanks.

  • dlchase

    Old Hand

    Points: 380

    Failed on line 374.

  • jmichaelbuckner

    Newbie

    Points: 5

    Msg 213, Level 16, State 1, Procedure FunGetIntervalDates, Line 373

    Column name or number of supplied values does not match table definition.

  • bhavin.gala05

    SSC Rookie

    Points: 42

    can you please tell me the passing values on function for which you are getting issues.

  • dlchase

    Old Hand

    Points: 380

    I did not run it, I was just compiling it when this error came up. It had to do with not having the same number of arguments in an insert.

  • akljfhnlaflkj

    SSC Guru

    Points: 76202

    dlchase (12/11/2015)


    I did not run it, I was just compiling it when this error came up. It had to do with not having the same number of arguments in an insert.

    Thanks for the insight.

  • bhavin.gala05

    SSC Rookie

    Points: 42

    Change the Last Else part with given below script.

    ELSE

    BEGIN

    INSERT @Table

    SELECT @EntityId AS Value,

    Rank()

    OVER(

    ORDER BY RecuringDATE) AS id,

    Rank() OVER (

    partition BY Datename(MM, RecuringDATE), Datename(yyyy, RecuringDATE), Datename(dw, RecuringDATE)

    ORDER BY RecuringDATE) AS Label,

    RecuringDATE,

    Datename(MM, RecuringDATE) AS DayName,

    Datename(dw, RecuringDATE) AS WeekName,

    ((SELECT Datepart(WEEK, RecuringDATE) - Datepart(WEEK, Dateadd(MM, Datediff(MM, 0, RecuringDATE), 0)) + 1)) AS Weeks,

    Datename(yyyy, RecuringDATE) AS year

    FROM @tempDATE

    ORDER BY RecuringDate

    END

    RETURN;

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

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