Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Constraint Management via SQL

Kjell_AKjell_A Member Posts: 1
Hi

I'm currently working a content management system in C#, that will among other databases support MS Access. Currently I'm working on a patcher that will allow to change the database structure at all the customers. However, when it comes to MS Access I'm having real problems in managing the constraints via SQL.

My first problem is that I cannot seem to be able to remove a NOT NULL constraint dynamically via SQL. I've tried ALTERing the columns and describing them with NULL or nothing at all, but yet the NOT NULL remains.

My other problems is with extracting the current constraints dynamically. The only constraints I can find are the foreign keys in the system tables. I am in need of finding the primary key constraints, the unique constraints, their names and the columns and tables they affect.

Any Access expert who could help me?

/Kjell

Comments

  • JA1JA1 Member Posts: 1
    Syntactically you can do

    [code]CREATE TABLE [Table_Name]
    (Field TEXT(1) NULL)[/code]

    But it doesn't seem to be doing anything - I'm currently trying to get that problem resolved ;-)

    [hr]

    [blue]http://msdn2.microsoft.com/en-us/library/aa140015(office.10).aspx[/blue]

    [code]ALTER TABLE tblCustomers
    ALTER COLUMN CustomerID INTEGER
    CONSTRAINT PK_tblCustomers PRIMARY KEY[/code]

    Hope this is what you want.

    J.
Sign In or Register to comment.