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. creating view for Month filter facility

creating view for Month filter facility

Scheduled Pinned Locked Moved Database
csharpdatabasevisual-studiohelp
4 Posts 2 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.
  • R Offline
    R Offline
    rrrriiizz
    wrote on last edited by
    #1

    hello all, am working with sqlserver 2000 am using view option for retrieve values in a table.am using vb.net(Vs 2005) as my Front End. my problem is whenever i retrieve values from the database it simply retrieves the first row of the database. but in my case i want to retrieve data's which wasmodified by Last month. am declring one field as month. in that am getting value like jan 07, feb 07, etc.... can i able to filter last month modified data's and then move it to a view and then retriving data's from that view, is it possible please give me suggestions as well as solutions...... Thanks

    K 1 Reply Last reply
    0
    • R rrrriiizz

      hello all, am working with sqlserver 2000 am using view option for retrieve values in a table.am using vb.net(Vs 2005) as my Front End. my problem is whenever i retrieve values from the database it simply retrieves the first row of the database. but in my case i want to retrieve data's which wasmodified by Last month. am declring one field as month. in that am getting value like jan 07, feb 07, etc.... can i able to filter last month modified data's and then move it to a view and then retriving data's from that view, is it possible please give me suggestions as well as solutions...... Thanks

      K Offline
      K Offline
      Krish KP
      wrote on last edited by
      #2

      while fetching from SQL Server it is possible, to filter for a specific month & year. for example if the modify_dt is the column with datetime datatype where clause for fetching this can be 1. WHERE modify_dt BETWEEN AND 2. WHERE month(modify_dt) = AND year(modify_dt) = if is for previous month (current month is Feb then prev. is Jan) WHERE month(modify_dt) = month(getdate) - 1 AND year(modify_dt) = year(getdate()) -- modified at 22:45 Tuesday 13th February, 2007

      R 1 Reply Last reply
      0
      • K Krish KP

        while fetching from SQL Server it is possible, to filter for a specific month & year. for example if the modify_dt is the column with datetime datatype where clause for fetching this can be 1. WHERE modify_dt BETWEEN AND 2. WHERE month(modify_dt) = AND year(modify_dt) = if is for previous month (current month is Feb then prev. is Jan) WHERE month(modify_dt) = month(getdate) - 1 AND year(modify_dt) = year(getdate()) -- modified at 22:45 Tuesday 13th February, 2007

        R Offline
        R Offline
        rrrriiizz
        wrote on last edited by
        #3

        Thanks For U r Reply. but i am declaring that month fields as nvarchar, am also uploaod all the databases from excel to Sql. Now is it Possible to get Last month Details? That table contain 42 fields and also No of records in it is nearly 850. Please help me to avoid olderdata's getting repeated. only i want last month Modified Records. Please tell me any other way to solve this Issue.:^).. Thank You

        K 1 Reply Last reply
        0
        • R rrrriiizz

          Thanks For U r Reply. but i am declaring that month fields as nvarchar, am also uploaod all the databases from excel to Sql. Now is it Possible to get Last month Details? That table contain 42 fields and also No of records in it is nearly 850. Please help me to avoid olderdata's getting repeated. only i want last month Modified Records. Please tell me any other way to solve this Issue.:^).. Thank You

          K Offline
          K Offline
          Krish KP
          wrote on last edited by
          #4

          does the data belongs to same year ? if so .... In SQL datepart(m, getdate()) returns current month number where clause can be used MonthField = datepart(m, getdate()) - 1

          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