Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. get data in financial year in sql

get data in financial year in sql

Scheduled Pinned Locked Moved Database
databasesql-serversysadminhelptutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Thanusree Duth
    wrote on last edited by
    #1

    How to get data in financial year(april -march) in stored procedure in sql server 2005?I googled a lot.But didnt find suit answer.Hope you help. :)

    E M 2 Replies Last reply
    0
    • T Thanusree Duth

      How to get data in financial year(april -march) in stored procedure in sql server 2005?I googled a lot.But didnt find suit answer.Hope you help. :)

      E Offline
      E Offline
      Estys
      wrote on last edited by
      #2

      Something like this you mean? Inputparameter is int @fiscalyear.

      WHERE (YEAR(yourdatefield) >= @fiscalyear AND MONTH(yourdatefield) >= 4)
      AND (YEAR(yourdatefield) <= (@fiscalyear + 1) AND MONTH(yourdatefield) <= 3)

      Cheers

      If you can read this, you don't have Papyrus installed

      1 Reply Last reply
      0
      • T Thanusree Duth

        How to get data in financial year(april -march) in stored procedure in sql server 2005?I googled a lot.But didnt find suit answer.Hope you help. :)

        M Offline
        M Offline
        Mycroft Holmes
        wrote on last edited by
        #3

        Because each company may have a different fiscal year, you need to actually have a strategy to deal with it in your data structure. there are a number of options! Have a function that converts a date to finscalyear/period (2010/01 = April) Actually store the correct fiscal values with the data. Maintian a "Period" table with all the relevant dates and FK it to your data (we use this method)

        Never underestimate the power of human stupidity RAH

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups