Presents your SQL SERVER E-NEWSLETTER for March 4, 2003 <-------------------------------------------> USE OBJECT SEARCH IN QUERY ANALYZER Object search functionality normally isn't installed in systems using SQL Server 7.0, but it is installed by default for SQL Server 2000 systems. Object search functionality for SQL Server 7.0 is available if the stored procedure sp_MSObjsearch is installed in the master database. Through Query Analyzer, you can use the object search functionality with SQL Server to search for: * tables * views * stored procedures * replication filters * user-defined functions * columns * indexes * triggers * extended procedures * constraints You can search for one of these objects, or a combination of more than one, in one database or in all databases. In the results pane from the object search window, you can highlight the object and right-click to display a context menu. From this menu, you can open the selected object or perform editing and scripting activities. If you want to find particular database objects in all the databases in a SQL Server instance, you could use the sp_MSObjsearch procedure within a script that is scheduled to run in regular intervals through SQL Agent: EXEC master..sp_helptext sp_MSObjsearch GO For both SQL Server 7.0 and SQL Server 2000, you will get comments prior to the T-SQL code in the procedure. The following is a partial listing of the procedure showing the initial comments identifying the interface for the procedure: -- =================================================== -- sp_MSobjsearch (for 7.0 servers) -- -- PARAMETERS -- =================================================== -- @searchkey default NULL -- @dbname default current db = dbb_name(), valid DB name -- or * (ALL) -- @objecttype default 1 (user table),, can be valid objtype -- or 4096 (ALL), see rremarks -- @hitlimit default 100 rows, 0 is all results -- @casesensitive default 0, only valid wwhen server is case sensitive -- @status default 0 = no status, 1 = send percentage -- progress status backk based on database/step -- @extpropname default NULL -- @extpropvalue default NULL -- -- REMARKS -- =================================================== -- @objecttype -- user table = 1 from @dbnaame..sysobjects -- system table = 2 from @dbnaame..sysobjects -- view = 4 from @dbnaame..sysobjects -- sp = 8 from @dbnaame..sysobjects -- rf(repl sp) = 16 from @dbnaame..sysobjects -- xp = 32 from @dbnaame..sysobjects -- trigger = 64 from @dbnaame..sysobjects -- UDF = 128 from @dbnaame..sysobjects -- DRI Constraints = 256 from @dbnaame..sysobjects -- log = 512 from @dbnaame..sysobjects -- column = 1024 from @dbnaame..syscolumns -- index = 2048 from @dbnaame..sysindexes -- all = 4096 -- =================================================== -- -- RETURN VALUES -- =================================================== -- 0 = success -- 1 = parameter error -- 2 = resultset truncated -- =================================================== ----------------------------------------