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 v/s ms access

sql v/s ms access

Scheduled Pinned Locked Moved Database
databasequestion
8 Posts 3 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
    sachees123
    wrote on last edited by
    #1

    sql query aur ms access main when i pass "select maid) from enquiry where regdate=#05/11/2009#" from sql access treate it as 11/05/2009 why??? and wats the solution

    M 1 Reply Last reply
    0
    • S sachees123

      sql query aur ms access main when i pass "select maid) from enquiry where regdate=#05/11/2009#" from sql access treate it as 11/05/2009 why??? and wats the solution

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

      Try this

      select maid) from enquiry where regdate=#05/Nov/2009#

      or this

      select maid) from enquiry where regdate=#2009/11/05#

      Read up on datetime

      S 1 Reply Last reply
      0
      • M Mycroft Holmes

        Try this

        select maid) from enquiry where regdate=#05/Nov/2009#

        or this

        select maid) from enquiry where regdate=#2009/11/05#

        Read up on datetime

        S Offline
        S Offline
        sachees123
        wrote on last edited by
        #3

        But for this i have to change Date/Time format of System to what u written.

        M 1 Reply Last reply
        0
        • S sachees123

          But for this i have to change Date/Time format of System to what u written.

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

          In Access you MUST be storing your data as a datetime data type, if you are storing it as varchar/string then you are screwed. SQL Server has a dateformat, I presume that Access has something similar (I know it has I just can't remember the format). This will allow you to control the format of the datestring when you need it.

          S 1 Reply Last reply
          0
          • M Mycroft Holmes

            In Access you MUST be storing your data as a datetime data type, if you are storing it as varchar/string then you are screwed. SQL Server has a dateformat, I presume that Access has something similar (I know it has I just can't remember the format). This will allow you to control the format of the datestring when you need it.

            S Offline
            S Offline
            sachees123
            wrote on last edited by
            #5

            Thats true, type in access is date/time and format is "Short Date - 26/12/2009". When i call this through SQL it change dd/mm/yyyy to mm/dd/yyyy. Where to change, in sql or access??? As i cant change system date / time format. tell

            L 1 Reply Last reply
            0
            • S sachees123

              Thats true, type in access is date/time and format is "Short Date - 26/12/2009". When i call this through SQL it change dd/mm/yyyy to mm/dd/yyyy. Where to change, in sql or access??? As i cant change system date / time format. tell

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

              sachees123 wrote:

              Where to change, in sql or access???

              Well, do you want to change the format that Access uses, or the one that SQL Server uses? For SQL Server, you'd set the time format like this;

              SET DATEFORMAT ydm;

              sachees123 wrote:

              As i cant change system date / time format.

              The user is the one who sets (or changes) the format, from the control panel. Other applications should display their dates using the format that the user provides. That means that one saves a datetime as a DATE-type. When displaying, convert to a string of the ShortDateFormat or LongDateFormat :)

              I are Troll :suss:

              S 1 Reply Last reply
              0
              • L Lost User

                sachees123 wrote:

                Where to change, in sql or access???

                Well, do you want to change the format that Access uses, or the one that SQL Server uses? For SQL Server, you'd set the time format like this;

                SET DATEFORMAT ydm;

                sachees123 wrote:

                As i cant change system date / time format.

                The user is the one who sets (or changes) the format, from the control panel. Other applications should display their dates using the format that the user provides. That means that one saves a datetime as a DATE-type. When displaying, convert to a string of the ShortDateFormat or LongDateFormat :)

                I are Troll :suss:

                S Offline
                S Offline
                sachees123
                wrote on last edited by
                #7

                I dont want to change any format anywhere. Its the access which is changing the format from dd/mm/yyyy to mm/dd/yyyy. Why it is doing and wats the solution?? Thats my question.

                L 1 Reply Last reply
                0
                • S sachees123

                  I dont want to change any format anywhere. Its the access which is changing the format from dd/mm/yyyy to mm/dd/yyyy. Why it is doing and wats the solution?? Thats my question.

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

                  sachees123 wrote:

                  Its the access which is changing the format from dd/mm/yyyy to mm/dd/yyyy.

                  Databases don't store dates in a specific format, they store them as numbers[^]. The database applies one of the predefined dateformats when you retrieve the value. You can change[^] the table-design to change the default format that's used for the date-column though.

                  I are Troll :suss:

                  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