SQL Server 2005
CREATE TABLE #TEMP (TABLENAME SYSNAME, OBJECTNAME SYSNAME,TYPE CHAR(10))
INSERT INTO #TEMP
EXEC SP_MSFOREACHDB "SELECT '?' DATABASENAME, NAME,TYPE FROM ?.SYS.ALL_OBJECTS WHERE NAME='YourSearchingObjectName'"
SELECT * FROM #TEMP
DROP TABLE #TEMP
SQL Server 2000
CREATE TABLE #TEMP (TABLENAME SYSNAME, OBJECTNAME SYSNAME,TYPE CHAR(10))
INSERT INTO #TEMP
EXEC SP_MSFOREACHDB "SELECT '?' DATABASENAME, NAME,XTYPE FROM ?..SYSOBJECTS WHERE NAME='YourSearchingObjectName'"
SELECT * FROM #TEMP
DROP TABLE #TEMP
Note : Replace "YourSearchingObjectName" with the object name which you are searching in the select query
Tuesday, May 27, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment