Use Windows.pkg Use DFClient.pkg Use cDbSplitterContainer.pkg Use dfTreeVw.pkg Use cCJGrid.pkg Use cSQLHelper.pkg Use cCJGridColumnRowIndicator.pkg Use cCJGridColumn.pkg /TableProps_SQL SELECT SCHEMA_NAME(tbl.schema_id) AS SchemaName, tbl.name as TableName, p.name AS ExtendedPropertyName, CAST(p.value as sql_variant) as ExtendedPropertyValue FROM sys.tables as tbl INNER JOIN sys.extended_properties AS p ON p.major_id=tbl.object_id AND p.minor_id=0 AND p.class=1 /* Deferred_View Activate_oTDocVw for ; Object oTDocVw is a dbView Set Border_Style to Border_Thick Set Size to 250 456 Set Location to 2 2 Set Label to "Table Documents" Global_Variable Handle ghoTreeView1 Object oDbSplitterContainer1 is a cDbSplitterContainer Set piSplitterLocation to 99 Object oDbSplitterContainerChild1 is a cDbSplitterContainerChild Object oTreeView1 is a TreeView Move Self to ghoTreeView1 Set Size to 249 98 Set Location to 0 0 Set peAnchors to anAll Procedure OnCreateTree String[][] sData Integer i Integer NumTables Integer iItemData iImage iSelImage Handle hRoot hItem Get SQLItems of ghoSQLHelper "Select [name] from [sys].[tables] where type = 'U'" to sData Move (SizeOfArray(sData) -1 ) to NumTables For iItemData from 0 to NumTables Get AddTreeItem sData[iItemData][0] hRoot iItemData iImage iSelImage to hItem Loop End_Procedure Global_Variable Handle ghoCJSQLGrid1 Procedure OnItemChanged Handle hItem Handle hItemOld String sValue Get ItemLabel hItem to sValue Send LoadMyData of ghoCJSQLGrid1 sValue End_Procedure End_Object End_Object Object oDbSplitterContainerChild2 is a cDbSplitterContainerChild Object oCJSQLGrid1 is a cCJGrid Set Size to 249 356 Set Location to 0 0 Set peAnchors to anAll Move Self to ghoCJSQLGrid1 Set piSortColumn to 0 Set pbHeaderReorders to True Set pbHeaderTogglesDirection to True // Procedure Activating // Forward Send Activating // // Assume this creates the data and calls InitializeData // Send LoadMyData 'tsysdflt' // End_Procedure Object oCJGridColumn1 is a cCJGridColumn Set piWidth to 153 Set psCaption to "Field Nbr" Set peDataType to 0 Set pbEditable to False End_Object Object oCJGridColumn2 is a cCJGridColumn Set piWidth to 341 Set psCaption to "Column" Set pbEditable to False End_Object Object oCJGridColumn3 is a cCJGridColumn Set piWidth to 541 Set psCaption to "Description" Procedure OnEndEdit String sOldValue String sNewValue String sTable String sColumn String sSchema Move 'dbo' to sSchema Handle hoItem If (sOldValue <> sNewValue) Begin Get SelectedRowValue of oCJGridColumn2 to sColumn Get CurrentTreeItem of ghoTreeView1 to hoItem Get ItemLabel of ghoTreeview1 hoItem to sTable Send SetColumnDescription sSchema sColumn sTable sNewValue End End_Procedure End_Object Procedure OnCreate Forward Send OnCreate End_Procedure Function RetrieveColumnDescriptions String sTableName Returns String[][] String[][] sStatusHelpData String[] sStatusHelpCols String[][] sColumnData Integer iColumns iColumn iFoundAt numDescs Integer hoReferenceFile String sSchema Get piRefrenceFileNo of ghoSQLHelper to hoReferenceFile Get_Attribute DF_FILE_OWNER of hoReferenceFile to sSchema Get SQLItems of ghosqlhelper ("SELECT [objname], [value] FROM [fn_listextendedproperty] ('MS_Description', 'schema', '" - sSchema - "', 'table', '" - sTableName - "', 'Column', NULL) order by objname;") to sStatusHelpData Get SQLItems of ghosqlhelper ("SELECT s.ORDINAL_POSITION , S.COLUMN_NAME, ' ' as Value FROM INFORMATION_SCHEMA.COLUMNS S WHERE TABLE_NAME = '" - sTableName - "' ORDER BY s.COLUMN_NAME ") to sColumnData For iColumn from 0 to (SizeOfArray(sStatusHelpData) -1) Move (sStatusHelpData[iColumn][0]) to sStatusHelpCols[iColumn] Loop For iColumn from 0 to (SizeOfArray(sColumnData) -1) Move (SizeOfArray(sStatusHelpCols)) to numDescs If (numDescs > 0) Begin Move (SearchArray( sColumnData[iColumn][1], sStatusHelpCols , Desktop , (RefFunc(DFSTRICMP)) )) to iFoundAt If (iFoundAt <> -1) Begin Move sStatusHelpData[iFoundAt][1] to sColumnData[iColumn][2] Move (RemoveFromArray(sStatusHelpCols,iFoundAt)) to sStatusHelpcols Move (RemoveFromArray(sStatusHelpData,iFoundAt)) to sStatusHelpData End End Loop Function_Return sColumnData End_Function Procedure SetColumnDescription String sSchema String sColumn String sTable String sDesc String sMySQl String[][] sStatusHelpData // Check first if it exists. Get SQLItems of ghosqlhelper ("SELECT [objname], [value] FROM [fn_listextendedproperty] ('MS_Description', 'schema', '" - sSchema - "', 'table', '" - sTable - "', 'Column', '" - sColumn- "') order by objname;") to sStatusHelpData If (SizeOfArray(sStatusHelpData) > 0) Begin Move "exec sp_UpdateExtendedProperty @name = N'MS_Description' ,@value = N'%4' " to sMySQl End Else Begin Move "exec sp_addextendedproperty @name = N'MS_Description' ,@value = N'%4' " to sMySQl End Append sMySQl " ,@level0type = N'Schema', @level0name = '%1'" Append sMySQl " ,@level1type = N'Table', @level1name = '%3' " Append sMySQl " ,@level2type = N'Column', @level2name = '%2' " Move (SFormat(sMySQl, sSchema, sColumn, sTable, sDesc)) to sMySQl Send SQLUpdate of ghoSQLHelper sMySQl End_Procedure Procedure LoadMyData String sTableName tDataSourceRow[] DataSourceArray String[][] sStatusHelpData Integer iRow Get RetrieveColumnDescriptions sTableName to sStatusHelpData For iRow from 0 to (SizeOfArray(sStatusHelpData) -1) Move sStatusHelpData[Irow] to DataSourceArray[iRow].sValue Loop Send InitializeData DataSourceArray End_Procedure End_Object End_Object End_Object Cd_End_Object