Google your SQL

We all have one snippet that we use several times daily (excluding logins/passwords), well here is one i like when working in SQL:

USE <DATABASE_NAME>
SELECT ROUTINE_NAME, ROUTINE_DEFINITION, LAST_ALTERED
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%KEYWORD%'
AND ROUTINE_TYPE = 'PROCEDURE'
ORDER BY ROUTINE_NAME

I call it my very own tiny Google. I am sure this has been posted before but I wanted to share it again. Not only you will get a much smaller set of stored procedures to look into but you also have a sense of when was it last modified (with this version).

Now, what do you paste more than 100 times a day?

One thought on “Google your SQL

  1. Abe Diaz says:

    To Find a table with a Keyword in its columns:
    SELECT OBJECT_NAME(object_id) as TableName
    FROM sys.columns
    WHERE name like ‘%KEYWORD%’;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: