开发者

How to find out the name of the constraint CHECK of a field in the MSAccess database?

I am implementing a solution for updating the schema of MSAccess databases on customer site and I am using DataWeigher to generate the update script.

My small console application wtitten in C# executes the generated script.

And now I want to change some existing validation rule of a field.

T开发者_StackOverflow社区o change an existing validation rule I would use following commandos:

ALTER TABLE myTable DROP CONSTRAINT <nameOfConstraint>
ALTER TABLE myTable ADD CONSTRAINT <nameOfConstraint> CHECK(myFiled<42)

The original validation rule was created manually (via MSAccess) and I do not know what name was given to this constraint by MSAccess.

How could I find out what the nameOfConstraint should be provide to the DDL commando?


According to this sample code, you can use DataTable.Constraints[Index].ConstraintName to get the name(s) and hopefully other properties to identify which constraint is to be changed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜