Monday, March 26, 2012

Primary Keys

Hi everyone,
Does someone knows how can I drop a primary key (that I don't know the name) from a table in one sql statement.
Thanks,
FadyEnterprise Manager ?|||I know I can use enterprise manager and I know that I can get the name of the primary key from sysobjects in a query but I need to know if I can in one sql statement (using alter table ... drop constraint as example) drop the primary key for a certain table.|||One of the odder requests seen on this forum.

To do it as a single statement you would need to EXECUTE an SQL String that you construct on the fly from the schema tables.

And I can't believe there would be a good reason for doing this.

No comments:

Post a Comment