I have a webcontrol that uses database-structures alot, it uses the system tables in SQL to read column information from tables. To ease the load of the SQL server I have a property that stores this information in a cache and everything works fine.
I am doing some research to find if there are anyway to get information from the SQL server that the structure from a table has changed.
I want to know if a column or table has changed any values, like datatype, name, properties, etc.
Any suggestions out there ?!Sure, use a DDL trigger. Anytime something changes that you need to know about insert a record into another table (tblDDLChanged?). Then use a SqlDependancy object on the tblDDLChanged table? Although you might be able to just use a set of SqlDependancy objects to monitor the base tables themselves, but I'm not sure if it detects DDL changes or not.|||I am not able to create any triggers only able to read the tables.|||After looking at the system tables I found the answer.
You retreive when last change was done to a column in a database by the following query:
SELECT TOP 1 sysobjects.refdate FROM syscolumns INNER JOIN sysobjects ON syscolumns.id = sysobjects.id ORDER BY sysobjects.refdate DESC
No comments:
Post a Comment