Stored procedure for Financial Year Insert

  • My Parameters will be Start Date And End Date Only...

    End Date should not greater than 1 year from start date..

    Ex.. Start date: 01.04.2009

    End Date:31.03.2010

    End date Should not accept 2011 during insert

  • manikandan-1115962 (10/24/2009)


    My Parameters will be Start Date And End Date Only...

    End Date should not greater than 1 year from start date..

    Ex.. Start date: 01.04.2009

    End Date:31.03.2010

    End date Should not accept 2011 during insert

    Hi

    is any error raised during insert or you want validation to stop 2011?

  • yes i need to raise error of date range exceeds more than 1 year from start date

  • manikandan-1115962 (10/24/2009)


    yes i need to raise error of date range exceeds more than 1 year from start date

    01)

    declare @stdate datetime,@todate datetime

    set @stdate = '2009-01-10'

    set @todate = '2009-10-10'

    if datediff(year,@stdate,@todate)<= 1

    begin

    insert mytable

    ....

    ....

    end

    else

    begin

    print'DATE RANGE MORE THAN A YEAR'

    END

    02)

    if (datediff(year,@stdate,@todate)<= 1) and (year(@todate)<2011)

    begin

    insert mytable

    ....

    ....

    end

    else

    begin

    print'DATE RANGE MORE THAN A YEAR'

    END

  • Hi Friend... Thanks a Lot your procedure is working fine..:-)

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

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