As a best pracrices type of thing, I thought keeping a data dictionary stored within the database it represents.So I made 2 tables to hold comments...I wasn't keen on using extended properties, as I want this to be portable for any platformSo I matched the sizes of the columns...and get an errorWarning! The maximum key length is 900 bytes. The index 'PK__Diversity_Column__62AFA012' has maximum length of 1024 bytes. For some combination of large values, the insert/update operation will fail.How does sql server resolve the issue of uniqueness in the catalog?CREATE TABLE Diversity_Columns ( TABLE_CATALOG nvarchar(128) NOT NULL, TABLE_SCHEMA nvarchar(128) NOT NULL, TABLE_NAME sysname NOT NULL, COLUMN_NAME sysname NOT NULL, Comments varchar(MAX) NULL, AddBy varchar(20) NOT NULL, AddDt datetime NOT NULL DEFAULT (GetDate()), UpdBy varchar(20) NOT NULL, UpdDt datetime NOT NULL DEFAULT (GetDate()))goCREATE INDEX XIF1Diversity_Columns ON Diversity_Columns( TABLE_CATALOG ASC, TABLE_SCHEMA ASC, TABLE_NAME ASC)goALTER TABLE Diversity_Columns ADD PRIMARY KEY CLUSTERED (COLUMN_NAME ASC, TABLE_SCHEMA ASC, TABLE_NAME ASC, TABLE_CATALOG ASC)goCREATE TABLE Diversity_Tables ( TABLE_CATALOG nvarchar(128) NOT NULL, TABLE_SCHEMA nvarchar(128) NOT NULL, TABLE_NAME sysname NOT NULL, Comments varchar(MAX) NULL, AddBy varchar(20) NOT NULL, AddDt datetime NOT NULL DEFAULT (GetDate()), UpdBy varchar(20) NOT NULL, UpdDt datetime NOT NULL DEFAULT (GetDate()))goALTER TABLE Diversity_Tables ADD PRIMARY KEY CLUSTERED (TABLE_CATALOG ASC, TABLE_SCHEMA ASC, TABLE_NAME ASC)goALTER TABLE Diversity_Columns ADD FOREIGN KEY (TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME) REFERENCES Diversity_Tables ( TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME)go
Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam