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. Hi , I need all dates of the current month

Hi , I need all dates of the current month

Scheduled Pinned Locked Moved Database
databasesql-serversysadmin
2 Posts 1 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.
  • S Offline
    S Offline
    Sneha Bisht
    wrote on last edited by
    #1

    Hi , i need all dates of the current month . m using sql server 2000 . Thanx in Advance .

    S 1 Reply Last reply
    0
    • S Sneha Bisht

      Hi , i need all dates of the current month . m using sql server 2000 . Thanx in Advance .

      S Offline
      S Offline
      Sneha Bisht
      wrote on last edited by
      #2

      Thanx i got it . And the sol is : declare @current varchar(100) set @current =(select convert(varchar,getdate(),101)) declare @firstdate varchar(100) declare @lastdate varchar(100) set @firstdate=(SELECT convert( varchar,DATEADD(dd,-(DAY(DATEADD(mm,1,@current))-1),DATEADD(mm,0,@current)),101)) set @lastdate=(SELECT convert(varchar, DATEADD(dd, -DAY(DATEADD(m,1,@current)), DATEADD(m,1,@current)),101)) print @firstdate print @lastdate declare @i int declare @k varchar(100) select @i = datediff(dd,@firstdate,@lastdate) print @i declare @j int set @j=0 while(@j<@i) begin select @k = dateadd( dd,1,@firstdate) print @k set @firstdate=@k set @j =@j + 1 end

      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