Results 1 to 3 of 3
  1. #1
    ivagor is offline Novice
    Windows Vista Access 2007
    Join Date
    Aug 2009
    Posts
    2

    Simple linked table. Complex underlying SQL statement

    Hi there!

    I have simple table in SQL that contains only one field "ID". Table is filled with continuous numbers.

    Just noticed that when I link in Access2007SP2 that SQL table using ODBC as a source Access uses strange and complex queries to get data:
    In a short it creates a complex "Where" with many OR clauses...



    Does anyone knows the reason of it? Can it be avoided to use just Select stateent without such a complex Where?

    I'll appreciate if someone can answer me or point on a proper location.

    /regards Ivan

    Here is SQL profiler output:

    1)SELECT "dbo"."A_Tst"."ID" FROM "dbo"."A_Tst"
    2) exec sp_prepexec @p1 output,N'@P1 int',N'SELECT "ID" FROM "dbo"."A_Tst" WHERE "ID" = @P1',1
    3)exec sp_prepexec @p1 output,N'@P1 int,@P2 int,@P3 int,@P4 int,@P5 int,@P6 int,@P7 int,@P8 int,@P9 int,@P10 int',
    N'SELECT "ID" FROM "dbo"."A_Tst"
    WHERE "ID" = @P1 OR "ID" = @P2 OR "ID" = @P3 OR "ID" = @P4 OR "ID" = @P5 OR "ID" = @P6 OR "ID" = @P7 OR "ID" = @P8 OR "ID" = @P9 OR "ID" = @P10',
    1,2,3,4,5,6,7,8,9,10

    Why does it use such approach?

  2. #2
    ivagor is offline Novice
    Windows Vista Access 2007
    Join Date
    Aug 2009
    Posts
    2
    question is closed.
    I've found article that desribe it:
    http://msdn.microsoft.com/en-us/libr...4(SQL.90).aspx
    "Optimizing Microsoft Office Access Applications Linked to SQL Server"

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Thanks for posting your solution as well.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Query on a linked table?
    By SilverSN95 in forum Queries
    Replies: 1
    Last Post: 09-26-2009, 03:00 PM
  2. update table in loop based on IF statement
    By LALouw in forum Access
    Replies: 0
    Last Post: 07-26-2009, 08:46 PM
  3. Linked table to sql 2000 db
    By tcroninstl in forum Access
    Replies: 1
    Last Post: 03-23-2009, 07:27 PM
  4. Editing a Linked Table
    By amndza in forum Access
    Replies: 2
    Last Post: 01-21-2009, 01:27 PM
  5. Linked Table Manager
    By driccardi in forum Access
    Replies: 4
    Last Post: 02-15-2006, 11:47 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums