On Jul 21, 2006, at 9:45 AM, [EMAIL PROTECTED] wrote:

Funny but his code was alos on a free table and not part of a DBC.

That's just what I meant by it being a sloppy implementation. Telling Fox to drop a foreign key on a free table should throw an error.

I have no idea if it matters. Here is code that determines if the key is
valid and then deletes the PKey.  Keys are constraints.

USE [ASPState]
GO
/****** Object: Index [PK__ASPStateTempAppl__5BE2A6F2] Script Date:
07/21/2006 08:43:45 ******/
IF  EXISTS (SELECT * FROM dbo.sysindexes
WHERE id = OBJECT_ID(N'[dbo].[ASPStateTempApplications]')
AND name = N'PK__ASPStateTempAppl__5BE2A6F2')

ALTER TABLE [dbo].[ASPStateTempApplications] DROP CONSTRAINT
[PK__ASPStateTempAppl__5BE2A6F2]

        Wow, that's sure some attractive code. :-P

        In MySQL it would be:

ALTER TABLE DROP INDEX Foo
( for ordinary indexes )

ALTER TABLE DROP PRIMARY KEY
( for PKs )

ALTER TABLE DROP FOREIGN KEY Foo
( for FKs )

        Calling them in inappropriate situations will raise an error.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com





_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to