Copyright © 2008-2018 Paula DiTallo

Tag Cloud

November 2010 Entries

In SQL Server, How Do I List all the Constraints by Table or by Column Name?

This one will order the contraints by table: Select SysObjects.[Name] As [Contraint Name] ,Tab.[Name] as [Table Name],Col.[Name] As [Column Name] From SysObjects Inner Join (Select [Name],[ID] From SysObjects Where XType = 'U') As Tab On Tab.[ID] = Sysobjects.[Parent_Obj] Inner Join sysconstraints On sysconstraints.Constid = Sysobjects.[ID] Inner Join SysColumns Col On Col.[ColID] = sysconstraints.[ColID] And Col.[ID] = Tab.[ID] order by Tab.[Name] This one will order the contraints by column: Select ......