none
Import query alters SQL RRS feed

  • Question

  • Access 2013 32-bit under Windows 7.

    I'm importing queries from one database to another.

    On checking that this has been done correctly, it seems that Access arbitrarily alters the SQL.

    It doesn't seem to follow any real pattern.

    Some changes:

    • Square brackets around table/query and field names added or removed
    • Round brackets for precedence added and/or removed in JOIN and WHERE clauses
    • =0 replaced by =False and =-1 by =True in Booleans

    Is there any way to make it not do that?

    MTIA,
    e.

    Wednesday, March 22, 2017 2:07 PM

Answers

  • Hi,

    Unfortunately, I'm not sure there's a way to clean up what Access is doing. I know some of the brackets are not necessary, but Access insists on adding them anyway. The only thing I might worry about is the precedence you mentioned. However, I would probably just trust Access of getting it correctly since verifying if it's correct would probably be too much of an effort at this point.

    Just my 2 cents...

    PS. If you want to compare results, you could link to the old data and run the same queries. Just a thought...

    • Marked as answer by exotericist Wednesday, March 22, 2017 3:17 PM
    Wednesday, March 22, 2017 3:12 PM

All replies

  • Hmm, I'm not sure if there is. Are the changes affecting the queries' performance? I hope you're at least getting the same results.
    Wednesday, March 22, 2017 2:43 PM
  • Thanks for the reply.

    The changes above don't necessarily change the output, no. (Except, perhaps the round brackets for precedence in the JOINs.)

    As ever, though, when I say "a query" I mean "200+ queries" and I'm trying to validate that they are the same using WinMerge.

    It's a bit time-consuming checking them by hand and eye.

    The data is different, so I can't compare result sets.

    Any ideas?

    Thanks again,
    e.

    Wednesday, March 22, 2017 3:00 PM
  • Hi,

    Unfortunately, I'm not sure there's a way to clean up what Access is doing. I know some of the brackets are not necessary, but Access insists on adding them anyway. The only thing I might worry about is the precedence you mentioned. However, I would probably just trust Access of getting it correctly since verifying if it's correct would probably be too much of an effort at this point.

    Just my 2 cents...

    PS. If you want to compare results, you could link to the old data and run the same queries. Just a thought...

    • Marked as answer by exotericist Wednesday, March 22, 2017 3:17 PM
    Wednesday, March 22, 2017 3:12 PM