Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to create a SQL2K trigger that updates other fields?
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00713079
Message ID:
00714484
Views:
23
I was looking for how to get the tables and field descriptions (when they are entered) and found out that they are stored in several system tables in my database. So I created two queries in order to get then as cursors, so here they are:


Here's the code (in T-SQL)
-- Tables descriptions:
SELECT sysobjects.name as cTable, sysproperties.value as cDescription 
FROM sysobjects 
JOIN sysproperties ON sysobjects.id = sysproperties.id 
WHERE sysproperties.smallid = 0
ORDER BY 1

-- Fields descriptions:
SELECT 
 sysobjects.name as cTable, 
 syscolumns.name as cColumn, 
 systypes.name as cType, 
 syscolumns.Length as nLength, 
 syscolumns.xprec as nPrecision, 
 syscolumns.xscale as nScale, 
 sysproperties.value as cDescription
FROM 
 syscolumns 
 JOIN sysproperties 
    ON syscolumns.id = sysproperties.id AND 
       syscolumns.colid = sysproperties.smallid
 JOIN sysobjects 
    ON syscolumns.id = sysobjects.id
 JOIN systypes 
    ON syscolumns.xtype = systypes.xtype
ORDER BY 1
It works for any SQL Server 2000 database.
I guess this will help anybody who has similar needs like mine or wants to document any SQL Server database.
Previous
Reply
Map
View

Click here to load this message in the networking platform