Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding constraint to a table
Message
From
13/03/2008 18:08:39
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
Other
Title:
Adding constraint to a table
Miscellaneous
Thread ID:
01301994
Message ID:
01301994
Views:
51
Am I correct to say that when we add a constraint to a table, such as for a primary key, that the name given has to be unique in the database? I have 120 tables where I have to define a constraint of type primary key and the field name is all Numero. So, all 120 tables have a field Numero. So, this means, if I do:
ALTER TABLE [Client] ADD CONSTRAINT Numero PRIMARY KEY (Numero)
that, it will work. But, doing another line following that one with:
ALTER TABLE [Country] ADD CONSTRAINT Numero PRIMARY KEY (Numero)
will not work because a constraint Numero already exists.

This irritates me because even if the field being defined as a primary key is Numero, the name that it will appear under under the Keys, Indexes and Statistics section would be the unique name I will have to give it. So, if I want to define the Numero field in all my tables as a primary key, is there a way to have it to be shown as Numero for each table under those 3 sections?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Next
Reply
Map
View

Click here to load this message in the networking platform