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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. query statement

query statement

Scheduled Pinned Locked Moved C#
databasesql-serversysadminhelp
8 Posts 5 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.
  • F Offline
    F Offline
    foysal mamun
    wrote on last edited by
    #1

    i use "Select * from tableName Where joinDate >= '02/05/2006' And joinDate <= '15/05/2006'". it does not work but why, i use sql server. plz help me.

    T L H S 5 Replies Last reply
    0
    • F foysal mamun

      i use "Select * from tableName Where joinDate >= '02/05/2006' And joinDate <= '15/05/2006'". it does not work but why, i use sql server. plz help me.

      T Offline
      T Offline
      Tamimi Code
      wrote on last edited by
      #2

      what do you mean by its not work ?? Tamimi - Code

      F 1 Reply Last reply
      0
      • T Tamimi Code

        what do you mean by its not work ?? Tamimi - Code

        F Offline
        F Offline
        foysal mamun
        wrote on last edited by
        #3

        i mean, it does not return any row but the table contains those type of row which satisfied this condition( joinDate >= '02/05/2006' And joinDate <= '15/06/2006')

        T 1 Reply Last reply
        0
        • F foysal mamun

          i mean, it does not return any row but the table contains those type of row which satisfied this condition( joinDate >= '02/05/2006' And joinDate <= '15/06/2006')

          T Offline
          T Offline
          Tamimi Code
          wrote on last edited by
          #4

          try to excute your query in the query analyzer and see what happen. if its work take a look to your code. Tamimi - Code

          1 Reply Last reply
          0
          • F foysal mamun

            i use "Select * from tableName Where joinDate >= '02/05/2006' And joinDate <= '15/05/2006'". it does not work but why, i use sql server. plz help me.

            L Offline
            L Offline
            Laubi
            wrote on last edited by
            #5

            sql won't recognise 02/05/2006! this is just a string and not a date.. Maybe this works 1900-01-04 00:00:00.000 but the safest way is to use an explicit cast like this CAST('1900-01-04 08:00' AS datetime)

            1 Reply Last reply
            0
            • F foysal mamun

              i use "Select * from tableName Where joinDate >= '02/05/2006' And joinDate <= '15/05/2006'". it does not work but why, i use sql server. plz help me.

              T Offline
              T Offline
              Tamimi Code
              wrote on last edited by
              #6

              sometimes the sql server configure the date as mm/dd/yy so 15/05/2006 is not a valid date Tamimi - Code

              1 Reply Last reply
              0
              • F foysal mamun

                i use "Select * from tableName Where joinDate >= '02/05/2006' And joinDate <= '15/05/2006'". it does not work but why, i use sql server. plz help me.

                H Offline
                H Offline
                Hesham Amin
                wrote on last edited by
                #7

                You better use the yyyyMMdd format with SQL server for dates: This :

                foysal mamun wrote:

                Select * from tableName Where joinDate >= '02/05/2006' And joinDate <= '15/05/2006'

                should be written like: Select * from tableName Where joinDate >= '20060502' And joinDate <= '20060515'

                1 Reply Last reply
                0
                • F foysal mamun

                  i use "Select * from tableName Where joinDate >= '02/05/2006' And joinDate <= '15/05/2006'". it does not work but why, i use sql server. plz help me.

                  S Offline
                  S Offline
                  Stephan Samuel
                  wrote on last edited by
                  #8

                  Does the exact query entered into SQL Server through Query Analyzer return any rows?

                  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