SQL Server Tables/Views list customization

 

In order to customize the "table list" (view, other…) displayed by the SQL Server interface, it is possible to modify the DDISQL.INI file and define the SQL Query to be used to get the required table list. The query must return 3 fields: 2 mandatory fields + 1 optional field:

  1. Schema or table owner.

  2. Table name.

  3. Description of the table.

 

That can be done for the SQL Server interface in general, by adding a « TABLESQUERY » entry in the [General] section, as in the following example:

 

[GENERAL]

TABLESQUERY=SELECT T2.name, T1.name FROM dbo.sysobjects T1,dbo.sysusers T2 WHERE T1.uid=T2.uid AND ( (T2.name LIKE '#Creator#%') ) AND ( (T1.name LIKE '#NameMask#%') ) AND (T1.type in ('U','V')) AND T1.name not in ('sysallocations','sysconstraints','sysalternates','syssegments','dtproperties') ORDER BY T2.name, T1.name

 

Here the Type "U" is corresponding to the users tables and the type "V" to the views, avoiding to display the System objects.

 

That is possible also to define only a specific configuration, by adding a « TABLESQUERY » entry in the section corresponding to the SQL Server configuration, as in the following example:

 

[ClicknDECiDE Demo]

TABLESQUERY=SELECT T2.name, T1.name FROM dbo.sysobjects T1,dbo.sysusers T2 WHERE T1.uid=T2.uid AND ( (T2.name LIKE '#Creator#%') ) AND ( (T1.name LIKE '#NameMask#%') ) AND (T1.type in ('U','V')) AND T1.name not in ('sysallocations','sysconstraints','sysalternates','syssegments','dtproperties') ORDER BY T2.name, T1.name

 

Caution: you must keep criteria with parameter #NameMask# and #Creator# because they are used when you browse in the tree database browser in “Vision “for a specific name.

 

See also: SQL Server Column List Customization