How to query different type database object like table, view, trigger using sysobject
following is the query for selecting all object from all database
|
SELECT name, id, xtype, uid, info, status, base_schema_ver, replinfo, parent_obj, crdate, ftcatid, schema_ver, stats_schema_ver, type, userstat, sysstat, indexdel, refdate,version, deltrig, instrig, updtrig, seltrig, category, cache
FROM sys.sysobjects
|
There are various parameter which you can use as where to specify criteria.
If you want to search certain object type then
XTYPE =
| ‘U’ | For table |
| ‘PK’ | For Primary Keys |
| ‘F’ | For Foreight Keys |
| ‘V’ | For views |
| ‘P’ | For stored procedures |
| ‘TR’ | For triggers |
| ‘S’ | For system objects |
| ‘FN’ | Function |
You can also add like query on name to give specific resultset.
Really a Cool
Ajit
September 12, 2009 at 3:07 pm