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. INSERT QUERY NOT WORKING

INSERT QUERY NOT WORKING

Scheduled Pinned Locked Moved Database
helpdatabase
18 Posts 11 Posters 5 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.
  • M mjawadkhatri

    please help.... this query is not working.. please tell me ERROR INSERT INTO test Values(TO_DATE('12/23/2010','dd/mm/yyyy')) Thnaks In Advance

    T Offline
    T Offline
    thatraja
    wrote on last edited by
    #7

    mjawadkhatri wrote:

    please tell me ERROR

    Actually you should tell us about that. what's the error message? FYI Oracle to_date usage[^]

    thatraja |Chennai|India|


    Brainbench certifications
    My Dad had a Heart Attack on this day so don't...

    M 1 Reply Last reply
    0
    • M mjawadkhatri

      please help.... this query is not working.. please tell me ERROR INSERT INTO test Values(TO_DATE('12/23/2010','dd/mm/yyyy')) Thnaks In Advance

      R Offline
      R Offline
      Ralf Bue
      wrote on last edited by
      #8

      Don't worry, you mixed days and months. There is no 23. month since I know. TO_DATE('12/23/2010', 'mm/dd/yyyy') or TO_DATE('23/12/2010', 'dd/mm/yyyy') try it manually before using it: select TO_DATE('12/23/2010', 'mm/dd/yyyy') from dual; Regards Ralf

      1 Reply Last reply
      0
      • T thatraja

        mjawadkhatri wrote:

        please tell me ERROR

        Actually you should tell us about that. what's the error message? FYI Oracle to_date usage[^]

        thatraja |Chennai|India|


        Brainbench certifications
        My Dad had a Heart Attack on this day so don't...

        M Offline
        M Offline
        mjawadkhatri
        wrote on last edited by
        #9

        i am Using SQL 2005 Msg 195, Level 15, State 10, Line 1 'TO_DATE' is not a recognized built-in function name.

        1 Reply Last reply
        0
        • P Pete OHanlon

          What error are you getting? What's the underlying data type in this field? What's the table definition (your query only stands a chance of working if there's only a date field in the table test)?

          I'm not a stalker, I just know things. Oh by the way, you're out of milk.

          Forgive your enemies - it messes with their heads

          My blog | My articles | MoXAML PowerToys | Onyx

          M Offline
          M Offline
          mjawadkhatri
          wrote on last edited by
          #10

          i am Using SQL Msg 195, Level 15, State 10, Line 1 'TO_DATE' is not a recognized built-in function name.

          P 1 Reply Last reply
          0
          • M mjawadkhatri

            please help.... this query is not working.. please tell me ERROR INSERT INTO test Values(TO_DATE('12/23/2010','dd/mm/yyyy')) Thnaks In Advance

            H Offline
            H Offline
            Hiren solanki
            wrote on last edited by
            #11

            Your query is allright IF a) You have only one column in table to insert b) You have function called TO_DATE created to give you supposed output compatible with column you have c) Your function taking two parameters as a INPUT.

            mjawadkhatri wrote:

            this query is not working.. please tell me ERROR

            Only SQL can give neither any of us, Sorry for that.

            Regards, Hiren.

            My Recent Article: - Way to know which control have raised a postback
            My Recent Tip/Trick: - The ?? Operator.

            L 1 Reply Last reply
            0
            • H Hiren solanki

              Your query is allright IF a) You have only one column in table to insert b) You have function called TO_DATE created to give you supposed output compatible with column you have c) Your function taking two parameters as a INPUT.

              mjawadkhatri wrote:

              this query is not working.. please tell me ERROR

              Only SQL can give neither any of us, Sorry for that.

              Regards, Hiren.

              My Recent Article: - Way to know which control have raised a postback
              My Recent Tip/Trick: - The ?? Operator.

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #12

              AND d) the parameters to to_date are consistent. TO_DATE('12/23/2010','dd/mm/yyyy') is no good. :)

              Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

              Season's Greetings to all CPians.

              P 1 Reply Last reply
              0
              • M mjawadkhatri

                i am Using SQL Msg 195, Level 15, State 10, Line 1 'TO_DATE' is not a recognized built-in function name.

                P Offline
                P Offline
                Pete OHanlon
                wrote on last edited by
                #13

                Are you using SQL Server? TO_DATE is Oracle syntax. The equivalent in SQL Server is CONVERT(datetime, '12/23/2010', 101)

                I'm not a stalker, I just know things. Oh by the way, you're out of milk.

                Forgive your enemies - it messes with their heads

                My blog | My articles | MoXAML PowerToys | Onyx

                M 1 Reply Last reply
                0
                • L Luc Pattyn

                  AND d) the parameters to to_date are consistent. TO_DATE('12/23/2010','dd/mm/yyyy') is no good. :)

                  Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

                  Season's Greetings to all CPians.

                  P Offline
                  P Offline
                  Pete OHanlon
                  wrote on last edited by
                  #14

                  AND e) He's not using Oracle. :rolleyes:

                  I'm not a stalker, I just know things. Oh by the way, you're out of milk.

                  Forgive your enemies - it messes with their heads

                  My blog | My articles | MoXAML PowerToys | Onyx

                  1 Reply Last reply
                  0
                  • P Pete OHanlon

                    Are you using SQL Server? TO_DATE is Oracle syntax. The equivalent in SQL Server is CONVERT(datetime, '12/23/2010', 101)

                    I'm not a stalker, I just know things. Oh by the way, you're out of milk.

                    Forgive your enemies - it messes with their heads

                    My blog | My articles | MoXAML PowerToys | Onyx

                    M Offline
                    M Offline
                    mjawadkhatri
                    wrote on last edited by
                    #15

                    Yes I am Using SQL Server 2005 and i need to insert date in dd/mm/yyyy format how it possible please help me

                    P 1 Reply Last reply
                    0
                    • M mjawadkhatri

                      Yes I am Using SQL Server 2005 and i need to insert date in dd/mm/yyyy format how it possible please help me

                      P Offline
                      P Offline
                      Pete OHanlon
                      wrote on last edited by
                      #16

                      A few thoughts.

                      1. Is this field actually a datetime?
                      2. Is it a datetime in your application?
                      3. What does the format of the date matter?

                      If the field is a datetime, and it's being passed in as a datetime then you don't need to do anything. Just insert it as it is - the only reason you'd convert it is if you were passing it in as a string, and you should really avoid this and pass it in as a datetime instead. The format of the date is immaterial - just store it in the universal date format; choosing the format is only relevant when you display the date to the user and you should use the users locale to do this.

                      I'm not a stalker, I just know things. Oh by the way, you're out of milk.

                      Forgive your enemies - it messes with their heads

                      My blog | My articles | MoXAML PowerToys | Onyx

                      1 Reply Last reply
                      0
                      • M mjawadkhatri

                        please help.... this query is not working.. please tell me ERROR INSERT INTO test Values(TO_DATE('12/23/2010','dd/mm/yyyy')) Thnaks In Advance

                        B Offline
                        B Offline
                        Bernhard Hiller
                        wrote on last edited by
                        #17

                        The bad thing is that the "S" in "SQL" means "structured", not "standard". Look at the "SQL Zoo" for the SQL code in many databases, e.g. http://sqlzoo.net/howto/source/u.cgi/tip218780[^]

                        1 Reply Last reply
                        0
                        • M mjawadkhatri

                          please help.... this query is not working.. please tell me ERROR INSERT INTO test Values(TO_DATE('12/23/2010','dd/mm/yyyy')) Thnaks In Advance

                          M Offline
                          M Offline
                          Member_14812547
                          wrote on last edited by
                          #18

                          Maybe because of semicolon you have missed. For your info : Oracle TO_DATE

                          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