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?