T
Thomas Tomiczek [MVP]
Hello,
I am trying to auto sync db schemata (in access, among other databases).
Means, there is a C# application that generates SQL for generating schema
changes in the access database.
I am stuck with two problems:
ONE: how can I turn an int field into a counter/identity field? The
following DDL statement:
ALTER TABLE [ShpCountry]
ALTER COLUMN [OID] COUNTER CONSTRAINT PK_OID PRIMARY KEY
Produces the following error: OleDbException, Invalid field data type. (SQL
State 3259).
It does work creating a field of this type. adly we DO have some databases
out where counter-fields were (erronously) generated as numeric fields, so I
need to get this changes.
TWO: how do I allow writing manual values into a counter field in SQL? We
need to load "start data" into the database. I WOULD be ok with turning them
back into a non-counter-field (i.e. numeric) to load the data, but then we
end up again on problem ONE - turning them back INTO a counter.
Anyone an idea how to handle this? I have all other stuff under control
(index creation, drops, everything), just the "numeric to counter" gets on
my nerves for weeks now.
--
Regards
Thomas Tomiczek
THONA Software & Consulting Ltd.
(Microsoft MVP C#/.NET)
(CTO PowerNodes Ltd.)
I am trying to auto sync db schemata (in access, among other databases).
Means, there is a C# application that generates SQL for generating schema
changes in the access database.
I am stuck with two problems:
ONE: how can I turn an int field into a counter/identity field? The
following DDL statement:
ALTER TABLE [ShpCountry]
ALTER COLUMN [OID] COUNTER CONSTRAINT PK_OID PRIMARY KEY
Produces the following error: OleDbException, Invalid field data type. (SQL
State 3259).
It does work creating a field of this type. adly we DO have some databases
out where counter-fields were (erronously) generated as numeric fields, so I
need to get this changes.
TWO: how do I allow writing manual values into a counter field in SQL? We
need to load "start data" into the database. I WOULD be ok with turning them
back into a non-counter-field (i.e. numeric) to load the data, but then we
end up again on problem ONE - turning them back INTO a counter.
Anyone an idea how to handle this? I have all other stuff under control
(index creation, drops, everything), just the "numeric to counter" gets on
my nerves for weeks now.
--
Regards
Thomas Tomiczek
THONA Software & Consulting Ltd.
(Microsoft MVP C#/.NET)
(CTO PowerNodes Ltd.)