Page 1 of 1

UpdatingTable and current/default schema

Posted: Wed 15 Jun 2016 16:40
by Deeem2031
Hello,
'til now you answered my questions just fine so here's the next challenge :wink:

When setting the property UpdatingTable it seems that it has to match the way the table is declared in the query. This is rather unfortunate if you are using the current schema.

For example this works fine:

Code: Select all

qu.SQL.Text := 'SELECT * FROM DBO.[Table]';
qu.Open;
qu.UpdatingTable := 'dbo.Table';
just like this:

Code: Select all

qu.SQL.Text := 'SELECT * FROM [Table]';
qu.Open;
qu.UpdatingTable := 'Table';
But this fails with 'Wrong UpdatingTable value - table Table is unknown':

Code: Select all

qu.SQL.Text := 'SELECT * FROM DBO.[Table]';
qu.Open;
qu.UpdatingTable := 'Table';
With Ado we used the property 'Unique Table' for which UpdatingTable seems to be the replacement and it worked fine in all this situations.

Code: Select all

TAdoQuery.Recordset.Properties['Unique Table'].Value := UpdatingTable;
I also found a relatively easy fix by replacing the line MSClasses.GenerateTableName 660

Code: Select all

if SchemaName <> '' then
with

Code: Select all

if (SchemaName <> '') and not SameText(SchemaName, DefaultSDACSchema) then
Though this doesn't check for the DEFAULT_SCHEMA of the current user...

Re: UpdatingTable and current/default schema

Posted: Thu 16 Jun 2016 10:47
by ViktorV
We will consider the possibility to change this behavior of SDAC in one of the next builds.