only My site

Wednesday, October 24, 2007

T-SQL - Tips for Developers

--To list the DB Names
SP_HELPDB
--To rename DB
SP_RENAMEDB
--User Def Table list
SP_TABLES
--User Def Table list with wildcard filter
SP_TABLES '%Attr%'
--Lists all the SPs uses the table object
SP_DEPENDS tableName
--SP Proc full list
SP_STORED_PROCEDURES
--SP Proc list with wildcard filter
SP_STORED_PROCEDURES '%SomeText%'
-- to get the table structure information
SP_HELP tableName
-- to get the SP code
SP_HELPTEXT spName
--Utility to take the class property name
select 'Namespace.Class.' + syscolumns.name objectname
from sysobjects,syscolumns,systypes
where sysobjects.id = syscolumns.id and
syscolumns.xtype = systypes.xtype and
syscolumns.isoutparam = 0 and
systypes.xusertype in (56,61,62,108,167,231,239) and
sysobjects.name = 'TABLE_NAME'
order by syscolumns.colorder

No comments: