I am not able to change a constraint in SQLite:
1. I created a schema in SQLite witth AutoCAD Map 3D 2012.
2. I set a constraint to one field: a list with 3 entries valid for the property. For example:
Test 1
Test 2
Test 3
3. I draw some lines
In the schema editor I want to change the constraint:
- But I am not able to add a new entry “Test 4” to the list from step 2
- I am also not able to change an existing entries (“test 1” to “test 1 new”)
Is it possible to change the settings of a constraint?
The help (http://docs.autodesk.com/MAP/2012/ENU/filesMUG/GUID-47B2AD48-11F7-45DA-9B11-979265C7FDA8.htm) says: “You cannot edit a schema to convert an existing field to use a different constraint type if the table already contains data. The table must be empty.”
But I do not want to change the “constraint type”. I want to change the entries of the list.
Thanks
Jens
Solved! Go to Solution.
Solved by swt-gis. Go to Solution.
Hi,
at least the help is right, and also: I do understand your situations (it get's sometimes frustrating having data finalized and then have to add or modify some fields).
What would I do:
Good luck, - alfred -
Alfred,
thank you for your answer.
Autodesk has now replied to me directly. Autodesk has also proposed to do an export/import.
Your idea to modify the SQLite-database is good. But unfortunately this does not work:
I've looked at how a “constraint in AutoCAD FDO schema” is implemented in SQLite. SQLite uses a SQL-constraint when a table is created:
CREATE TABLE "testtable” … "testfield" TEXT CONSTRAINT CHK_Typ CHECK("testfield " IN(‘Test 1, Test 1, Test 1)) …
Normaly I would drop the existing constraint, and add the new constraint:
ALTER TABLE ... DROP CONSTRAINT CHK_Typ
ALTER TABLE ... ADD CONSTRAINT CHK_Typ ...
The problem is that SQLite does not support a CONSTRAINT option in the ALTER command (http://www.sqlite.org/omitted.html).
In my opinion this is very great limitation of a geodatabase based on SQLite.
Thanks for your help.
Regards
Jens
I agree with Alfred - the new schema (possibly from an export/import of just the schema), then a bulkcopy is likely the easiest route, considering the SQLite limitations.