This is the way I do it.

R>LIST CONSTRAINTS FOR TABLE <tablename>

#45 ....
#44 ....

R>ALTER TABLE <tablename> DROP CONSTRAINT #45



Michael Moser <[EMAIL PROTECTED]> wrote:

>I have a need to remove a Foreign Key in an command file but have been unable to 
>discern the proper syntax.
>
>Help file says:
>
>ALTER TABLE tablename DROP CONSTRAINT conname
>
>But I can not figure out exactly what conname is. �I thought it was Constraint Name 
>which (as far as I can tell) can not be defined as part of the constraint but is 
>assigned a number name by the system. �The number assigned, in the form "#nn", can 
>seen in the Table Definitions form and can also be found in the Sys_Indexes table in 
>the Sys_Index_Name column, so I tried:
>
>ALTER TABLE tablename DROP CONSTRAINT #45
>ALTER TABLE tablename DROP CONSTRAINT "#45"
>ALTER TABLE tablename DROP CONSTRAINT 45
>
>I also tired:
>ALTER TABLE tablename DROP CONSTRAINT FOREIGN KEY
>ALTER TABLE tablename DROP CONSTRAINT FOREIGN KEY (columnname)
>... and others
>
>but no matter what I try to use I get an
>
>-ERROR- Invalid constraint identifier. (2743)
>
>error message. �Once again, I am sure it is simple but I can't find it...
>
>Can anyone point me in the right direction?
>
>Thanks!
>
>Michael Moser
>EXAQ Micro Services
>www.exaq.com
>Phone: 916-768-7656
>Fax: 916-966-8313
>
>


-- 
Albert Berry
Full Time Consultant to
PSD Solutions
350 West Hubbard, Suite 210
Chicago, IL 60610
312-828-9253 Ext. 32


__________________________________________________________________
McAfee VirusScan Online from the Netscape Network.
Comprehensive protection for your entire computer. Get your free trial today!
http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397

Get AOL Instant Messenger 5.1 free of charge.  Download Now!
http://aim.aol.com/aimnew/Aim/register.adp?promo=380455

Reply via email to