开发者

Search a string in sql server database at design time [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I was wondering if there is any way to search a string in whole database while designing (something like searching a string in visual studio entire solution) Edit: I mean searchi开发者_C百科ng a string in all stored procedures , functions , tables ... its useful for doing some operations like updating all stored procedures and functions after changing a column type for some table.

I use microsoft sql server 2008

thanks


I think, you need RedGate SQLSearch tool. This tool is free.


To look for code in the database you can search sys.sql_modules (see example) or use something like Red Gate SQL Search which is free

I assume this is what you mean when you want the design time VS search. Note that database code live in system tables: not in files. Hence this SQL or tool is required.

SQL example:

SELECT
   OBJECT_SCHEMA_NAME(object_id) + '.' + OBJECT_NAME(object_id)
FROM
   sys.sql_modules
WHERE
   definition like '%whatever%'

Note: syscomments is legacy and splits the definition into nvarchar 4000 chunks thus risking not finding what you want. The same applies to INFORMATION_SCHEMA.ROUTINES


Though use case is really not useful, there is no way to search data like that, you must write sql to do so.

If you want to search objects ,there are some free add ins available which can help you search the tables, views, stored procedures and functions using a keyword.

Take a look at: http://weblogs.sqlteam.com/mladenp/archive/2007/11/20/Free-SQL-Server-tools-that-might-make-your-life-a.aspx


If I understood correctly - you need full-text search in database. It's database dependent, what database engine do you use? For MSSQL have a look at Full-Text Search (SQL Server)


One option is to use the Generate and Publish Scripts Wizard and create a script for all database objects. Then use a free text editor like Notepad++ to search through the script for the string.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜