how do you drop a constraint without a name through SQL-query?

the.freerider

New member
Local time
Today, 23:36
Joined
Nov 3, 2006
Messages
1
Hello,

I have a script that creates a database (v8.9) with some tables (tbl_Roles and tbl_Users).
After the creation of the tables I have this line:

ALTER TABLE tbl_Users ADD FOREIGN KEY (RoleID) REFERENCES tbl_Roles (RoleID)

Now I have to write an update script that changes the database to version (v9.0). In this new version there is no need of the FOREIGN KEY (RoleID) in tbl_Users so I have to do a query to drop this COLUMN/CONSTRAINT.

How do I remove the COLUMN RoleID from table tbl_Users?

I tried to do a
ALTER TABLE tbl_Users DROP COLUMN RoleID

but it does not work because of the CONSTRAINT.

I cannot do a
ALTER TABLE tbl_Users DROP CONSTRAINT <name>
because there is no <name> for the constraint?

Is there a query that renames the constraint to be able to use DROP CONSTRAINT <name>?


Thank you in advance
/Freerider
 

Users who are viewing this thread

Back
Top Bottom