dbTalk Databases Forums  

SSMS and constraints

microsoft.public.sqlserver.tools microsoft.public.sqlserver.tools


Discuss SSMS and constraints in the microsoft.public.sqlserver.tools forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
John A Grandy
 
Posts: n/a

Default SSMS and constraints - 07-30-2009 , 05:52 PM






Via sql , I created a unique constraint on my table , but in SSMS it doesn't
show up in the Constraints list but rather in the Indexes list. I know that
Sql Server internally implements unique constraints as indexes , but why
won't it show up in the SSMS Constraints list ? Is that list for default
constraints only ?


CREATE TABLE [dbo].[CruiseShipPortOfCall](
[Id] [int] IDENTITY(1,1) NOT NULL,
[CruiseShipId] [int] NOT NULL,
[PortOfCallId] [int] NOT NULL,
CONSTRAINT [PK_CruiseShipPortOfCall] PRIMARY KEY CLUSTERED
(
[Id] ASC
),
CONSTRAINT [CK_CruiseShipPortOfCall_CruiseShipId_PortOfCallId] UNIQUE
NONCLUSTERED
(
[CruiseShipId] ASC,
[PortOfCallId] ASC
)
)

Reply With Quote
  #2  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: SSMS and constraints - 07-31-2009 , 05:22 PM






John A Grandy (johnagrandy-at-gmail-dot-com) writes:
Quote:
Via sql , I created a unique constraint on my table , but in SSMS it
doesn't show up in the Constraints list but rather in the Indexes list.
I know that Sql Server internally implements unique constraints as
indexes , but why won't it show up in the SSMS Constraints list ? Is
that list for default constraints only ?
And CHECK constraints.

But not PRIMARY KEY, UNIQUE or FOREIGN KEY constraints. All these are
however in the Keys node. And, as you noted, PK and UNIQUE constraints
also show up in the Indexes node.

I'm not going to try do defend this listing. It could make sense to
collapse the Keys and Constraint nodes into one, possibly with subnodes
for the different types of constraints. It could also make sense to rename
Constraints to "CHECK Constraints", and don't include defaults here at all,
but only with the columns. (While they are implemented with the CONSTRAINT
syntax, defaults are not constraints from a logical point of view.)


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.