SLQ Foreign Key Constraint

SLQ Foreign Key Constraint

Anonymous
Not applicable
550 Views
1 Reply
Message 1 of 2

SLQ Foreign Key Constraint

Anonymous
Not applicable

Hi,

 

Everytime when i make a sql Table with a geometry object, and add a foreign key constraint, i get errors on data load in map3d. (Removing the constraint of the FK and the data load succeeds in MAP3D, but this is not really an option since we uses entity framework for the development and we want to maintain te relations..) Is theire some how a work around, or some requirements to make this work?

 

An other option also would be put an extra relation table with a 1-1 relation between the geometry table and the other tables, but this can't be our only option to just make it work in autocad map3D or is it???

 

I am using SQL Server 16 and Autodesk Map 3d 2016.

 

my regards,

 

Christophe

0 Likes
551 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

Instead of foreign key, tracking those fields from triggers (BEFORE AND AFTER INSERT OR UPDATE OR DELETE).

Exemple before delete.

before delete on Table_1
for each row
begin
   delete from Table_2
   where  field_1 = :old.field_1
   and    field_2 = :old.field_2
   and    field_3 = :old.field_3;
exception when others then
   raise_application_error(-2001,'trigger: Table1_tbd; erreur: '||sqlerrm);
end;

 

0 Likes