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. SQL

SQL

Scheduled Pinned Locked Moved Database
databaseregexhelp
5 Posts 5 Posters 1 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.
  • N Offline
    N Offline
    nukalarajesh
    wrote on last edited by
    #1

    in my database Table i have a column name BookDate(nvarchar) 22/03/2013 01:25 PM stored data in this format now i need to match only with date out of date time it should be matched with current date please help with a query Thanking you

    Richard DeemingR L M G 4 Replies Last reply
    0
    • N nukalarajesh

      in my database Table i have a column name BookDate(nvarchar) 22/03/2013 01:25 PM stored data in this format now i need to match only with date out of date time it should be matched with current date please help with a query Thanking you

      Richard DeemingR Online
      Richard DeemingR Online
      Richard Deeming
      wrote on last edited by
      #2

      nukalarajesh wrote:

      BookDate(nvarchar)

      Don't store dates as strings. Change the column to datetime (or datetime2(0) if you're using SQL 2008 or higher), and then query for BookDate >= @Today And BookDate < @Tomorrow.


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      1 Reply Last reply
      0
      • N nukalarajesh

        in my database Table i have a column name BookDate(nvarchar) 22/03/2013 01:25 PM stored data in this format now i need to match only with date out of date time it should be matched with current date please help with a query Thanking you

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        If you are wondering why your other post was removed (in less than 10 minutes!), it was because of the "urgency". We're volunteers, answering questions in our spare time. Had you included it with your question, then the question would have been gone too. If you want an answer "fast", then you better make sure that there's a clear problem description, and some example-code showing what you tried to achieve. You might also want to include a subject-line that's a bit more descriptive; posts in the database-forum usually have some SQL, and it doesn't give a clue of what you're doing.

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

        1 Reply Last reply
        0
        • N nukalarajesh

          in my database Table i have a column name BookDate(nvarchar) 22/03/2013 01:25 PM stored data in this format now i need to match only with date out of date time it should be matched with current date please help with a query Thanking you

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

          Just in case you did not take Richard seriously - DO NOT STORE DATES AS TEXT, USE THE DATETIME DATATYPE. This is the basis of your problem. How do I make that red, can I make it flash, can I make it jump through the monitor and thump it into the desk?

          Never underestimate the power of human stupidity RAH

          1 Reply Last reply
          0
          • N nukalarajesh

            in my database Table i have a column name BookDate(nvarchar) 22/03/2013 01:25 PM stored data in this format now i need to match only with date out of date time it should be matched with current date please help with a query Thanking you

            G Offline
            G Offline
            GugliMugli
            wrote on last edited by
            #5

            use trunc(your_field name)= trunc(sysdate) or sysdate-1 for yesterday. or trunc(field_name)='12-apr-2012'

            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