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. why i am unable to retrieve holiday name

why i am unable to retrieve holiday name

Scheduled Pinned Locked Moved Database
databasehelpquestion
3 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.
  • U Offline
    U Offline
    User 8664010
    wrote on last edited by
    #1

    declare @i int

    set @i=1

    select Holiday_Name from Holiday where Holiday_On = DATEADD(day,@i,CONVERT(date,GETDATE()))

    i am trying to retrieve holidays list from db.but i am unable to retrieve ....can anyone tell me pls what is the error in my query

    M 1 Reply Last reply
    0
    • U User 8664010

      declare @i int

      set @i=1

      select Holiday_Name from Holiday where Holiday_On = DATEADD(day,@i,CONVERT(date,GETDATE()))

      i am trying to retrieve holidays list from db.but i am unable to retrieve ....can anyone tell me pls what is the error in my query

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

      Assuming you are using SQL Server - take your code to SSMS and test it, then tell us that the error is. If there is no error then check there is a record to get.

      Never underestimate the power of human stupidity RAH

      U 1 Reply Last reply
      0
      • M Mycroft Holmes

        Assuming you are using SQL Server - take your code to SSMS and test it, then tell us that the error is. If there is no error then check there is a record to get.

        Never underestimate the power of human stupidity RAH

        U Offline
        U Offline
        User 8664010
        wrote on last edited by
        #3

        i don't know how to use if...exists i am new to asp.net & database as well my requirement is to get 3 consecutive working days declare @i int declare @count int set @i=0 set @count=0 while(@count <= 3) begin 1) select Holiday_Name from Holiday where Holiday_On = DATEADD(day,@i,CONVERT(date,GETDATE())) the above statement is to check whether holiday exists 2) IF DATEPART(day, DATEADD(day,@i,CONVERT(date,GETDATE()))) = 7 OR DATEPART(dw, DATEADD(day,@i,CONVERT(date,GETDATE()))) = 1 the 2nd statement is to check whether weekend or not set @i = @i + 1 if there no holiday and not weekend then only the following code is executed set @count = @count + 1 here i have to retrieve the date...i don't know how to get the date...because i vil get 3 dates... end actually i no need to select holiday name in 1)statement...there i am checking for holiday..

        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