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. Other Discussions
  3. Clever Code
  4. SQL-statements that seem correct

SQL-statements that seem correct

Scheduled Pinned Locked Moved Clever Code
helpcsharpdatabasecomtools
7 Posts 4 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.
  • V Offline
    V Offline
    V 0
    wrote on last edited by
    #1

    I just had a bunch of generated SQL statements which failed. I couldn't find what was wrong and the statements succeeded when I performed them manually. It seems that Jet4 (OleDb) and ODBC have certain keywords that you can't use in your statements. (In my case it was "ACTION", but there are probably more.) For your reference: C# forum[^] Renaming the key-word in the statement will resolve this issue. Hope this can help some people :-).

    V.
    Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive

    CPalliniC G 2 Replies Last reply
    0
    • V V 0

      I just had a bunch of generated SQL statements which failed. I couldn't find what was wrong and the statements succeeded when I performed them manually. It seems that Jet4 (OleDb) and ODBC have certain keywords that you can't use in your statements. (In my case it was "ACTION", but there are probably more.) For your reference: C# forum[^] Renaming the key-word in the statement will resolve this issue. Hope this can help some people :-).

      V.
      Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive

      CPalliniC Online
      CPalliniC Online
      CPallini
      wrote on last edited by
      #2

      V. wrote:

      It seems that Jet4 (OleDb) and ODBC have certain keywords that you can't use in your statements.

      you can also enclose your identifier in square brackets (e.g. [ACTION]), I use to do that to avoid worrying about identifier collisions. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

      In testa che avete, signor di Ceprano?

      V 1 Reply Last reply
      0
      • CPalliniC CPallini

        V. wrote:

        It seems that Jet4 (OleDb) and ODBC have certain keywords that you can't use in your statements.

        you can also enclose your identifier in square brackets (e.g. [ACTION]), I use to do that to avoid worrying about identifier collisions. :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

        V Offline
        V Offline
        V 0
        wrote on last edited by
        #3

        tried that, but it failed. it converts it back to "ACTION". even if I do [TABLENAME].[COLNAME] Could be that I convert that in my DAL component (should check that ;P) but I don't think so.

        V.
        Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive

        P 1 Reply Last reply
        0
        • V V 0

          tried that, but it failed. it converts it back to "ACTION". even if I do [TABLENAME].[COLNAME] Could be that I convert that in my DAL component (should check that ;P) but I don't think so.

          V.
          Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #4

          It works for me, with Access and SQL Server.

          V 1 Reply Last reply
          0
          • V V 0

            I just had a bunch of generated SQL statements which failed. I couldn't find what was wrong and the statements succeeded when I performed them manually. It seems that Jet4 (OleDb) and ODBC have certain keywords that you can't use in your statements. (In my case it was "ACTION", but there are probably more.) For your reference: C# forum[^] Renaming the key-word in the statement will resolve this issue. Hope this can help some people :-).

            V.
            Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive

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

            Problems with keywords in SQL is a quite common problem. There is one that is even a bit more subtle than your example, that I have seen several times: The swedish word for "lives" is "bor". This is sometimes used as a field name for the purpose of storing the name of a location where the user lives. The problem is that it's a reserved keyword as it's also the name of the not so frequently used binary or operator.

            --- b { font-weight: normal; }

            1 Reply Last reply
            0
            • P PIEBALDconsult

              It works for me, with Access and SQL Server.

              V Offline
              V Offline
              V 0
              wrote on last edited by
              #6

              My DAL component is quite old, I created it the first time in .NET 1.0 and just recompiled it to 1.1 and 2.0 later. It might be that the adapters are a bit 'old' ;). tnx.

              V.
              Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive

              P 1 Reply Last reply
              0
              • V V 0

                My DAL component is quite old, I created it the first time in .NET 1.0 and just recompiled it to 1.1 and 2.0 later. It might be that the adapters are a bit 'old' ;). tnx.

                V.
                Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive

                P Offline
                P Offline
                PIEBALDconsult
                wrote on last edited by
                #7

                Chances are. But I don't see why it would be removing the [ and ]

                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