Search for an expression in Redgate's SQL Search



  • I can find word and terms inside stored proc and database, but I can't specifically search for an expression like WHERE name LIKE '%005%'.

    Is it possible to do that with the Redgate SQL Search plugin for SSMS?

    I couldn't find anything that allows me to search for complex expressions.



  • You should refer to RedGate's https://documentation.red-gate.com/ss/how-to-search for usage information, and specifically the https://documentation.red-gate.com/ss/how-to-search#Howtosearch-Wildcards which state:

    Asterisk (*) wildcard

    You can use * as a wildcard to match 0 or more characters, similar to a SQL LIKE clause.

    For example, search for 'b*' to find all objects containing words beginning with b.

    So in your case you'd want to use *005*. Also make sure you have "Use Wildcards" checked off in the SQL Search UI as well.

    Note that RedGate SQL Search is likely querying the https://docs.microsoft.com/en-us/sql/relational-databases/system-catalog-views/catalog-views-transact-sql?view=sql-server-ver15 to satisfy the search that's entered, with a basic UI facing the end user. You could use T-SQL against the system catalog to emulate the same functionality and with the ability to do more complex filtering, for example sys.procedures to search for all procedures that contain a given name like so:

    SELECT [name] --, add whatever other columns you need here
    FROM sys.procedures
    WHERE [name] LIKE '%005%'
    

    Please see https://docs.microsoft.com/en-us/sql/relational-databases/system-catalog-views/querying-the-sql-server-system-catalog-faq?view=sql-server-ver15 for more helpful information on using the system catalog.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2