Forum Replies Created

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

  • RE: Using LAST_VALUE

    This is Cool... 🙂

  • RE: Using LAST_VALUE

    Hi chiesa,

    Your Suggestion will also work... But

    As per Performance Tuning matter,

    in your Solution.

    First of all the Data will be Sorted in DESC Order and then It will Apply...

  • RE: Using LAST_VALUE

    Hi,

    You Can achieve the same Result by below statement for FIRST_VALUE and LAST_VALUE

    ------------------------------------------------FIRST_VALUE-------------------------------------------------------

    SELECT

    CustomerID

    , SalesOrderID

    ...

  • RE: Get month days

    Hi,

    This is Simple Function to get Month days for current Month

    /***********************************************/

    /***********************************************/

    /***********************************************/

    CREATE FUNCTION dbo.FnDaysOfCurrentMonth(@myDate DATE) RETURNS INT

    AS

    BEGIN

    DEclare @Month int

    DECLARE @days int

    select @month=month(@myDate)

    IF @Month =2

    BEGIN

    IF (Year(@myDate)%4)=0

    BEGIN

    SET @days=29

    END

    ELSE

    BEGIN

    set @days=28

    END

    END

    ELSE

    BEGIN

    select @days =day(DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,@myDate)+1,0)))

    END

    RETURN @days

    END

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