Tony:
If you want to do this manually, the command is LIST CONSTRAINTS FOR 
<TableName>.  This will show you all constraints (PK, FK, Unique, NOT NULL) 
along with their names.
Unfortunately, if you have multiple copies of your database or will be doing 
this more than once on the same database you'll find that constraint names 
change from DB to DB or from time to time if you drop and recreate them.  If 
this is something that needs to happen automatically, you have to write code to 
figure out what the name of the constraint is each time, and that's not easy.  
I have a stored procedure that will find and drop the primary key given a table 
name (happy to share); doing the same thing for a foreign key would be more 
difficult.
It would be a nice enhancement if R:Base:
   
   - Allowed you to name the constraint when you created it.
   - OR Named constraints in some predictable manner.
 

    On Tuesday, September 27, 2016 10:15 AM, Tony IJntema <[email protected]> 
wrote:
 

 Hi,

I like to remove a column from a table, which also happens to be a foreign key.
So I have ro remove the Foreign key first and then drop the column.

The proper commands are:

alter table <table> drop constraint <conname>
alter table <table> drop column <colum>

My problem is that I don't know the <conname>.
Does anybody knows how to find this conname?


Tony

-- 
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.


   

-- 
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to