Hi,
We have a database where no PK constraints are defined and only unique
clustered indexes. Is there a way for us to change all the columns that make
up the unique clustered index in all of the tables in the database to be the
columns that make up the PK constraint of the tables? In other words, we
want to change the clustered indexes to actual PK constraints.
Thanks,
DeeThere is no easy way. You have to drop the CI and then run the alter table
commands. You could use the system catalogs to help generate the commands
though.
--
Jason Massie
www: http://statisticsio.com
rss: http://feeds.feedburner.com/statisticsio
"bpdee" <bpdee@.discussions.microsoft.com> wrote in message
news:8366A973-76BE-4731-8960-E3D487D41AB8@.microsoft.com...
> Hi,
> We have a database where no PK constraints are defined and only unique
> clustered indexes. Is there a way for us to change all the columns that
> make
> up the unique clustered index in all of the tables in the database to be
> the
> columns that make up the PK constraint of the tables? In other words, we
> want to change the clustered indexes to actual PK constraints.
> Thanks,
> Dee
Showing posts with label indexes. Show all posts
Showing posts with label indexes. Show all posts
Monday, March 19, 2012
Convert unique clustered indexes to PK constraints
Hi,
We have a database where no PK constraints are defined and only unique
clustered indexes. Is there a way for us to change all the columns that make
up the unique clustered index in all of the tables in the database to be the
columns that make up the PK constraint of the tables? In other words, we
want to change the clustered indexes to actual PK constraints.
Thanks,
Dee
There is no easy way. You have to drop the CI and then run the alter table
commands. You could use the system catalogs to help generate the commands
though.
Jason Massie
www: http://statisticsio.com
rss: http://feeds.feedburner.com/statisticsio
"bpdee" <bpdee@.discussions.microsoft.com> wrote in message
news:8366A973-76BE-4731-8960-E3D487D41AB8@.microsoft.com...
> Hi,
> We have a database where no PK constraints are defined and only unique
> clustered indexes. Is there a way for us to change all the columns that
> make
> up the unique clustered index in all of the tables in the database to be
> the
> columns that make up the PK constraint of the tables? In other words, we
> want to change the clustered indexes to actual PK constraints.
> Thanks,
> Dee
We have a database where no PK constraints are defined and only unique
clustered indexes. Is there a way for us to change all the columns that make
up the unique clustered index in all of the tables in the database to be the
columns that make up the PK constraint of the tables? In other words, we
want to change the clustered indexes to actual PK constraints.
Thanks,
Dee
There is no easy way. You have to drop the CI and then run the alter table
commands. You could use the system catalogs to help generate the commands
though.
Jason Massie
www: http://statisticsio.com
rss: http://feeds.feedburner.com/statisticsio
"bpdee" <bpdee@.discussions.microsoft.com> wrote in message
news:8366A973-76BE-4731-8960-E3D487D41AB8@.microsoft.com...
> Hi,
> We have a database where no PK constraints are defined and only unique
> clustered indexes. Is there a way for us to change all the columns that
> make
> up the unique clustered index in all of the tables in the database to be
> the
> columns that make up the PK constraint of the tables? In other words, we
> want to change the clustered indexes to actual PK constraints.
> Thanks,
> Dee
Subscribe to:
Posts (Atom)