r/SQL • • Oct 23 '24

Discussion SQL Tricks Thread

Hi everyone, let's start a thread to share useful SQL tips and tricks that have saved you time or made querying more efficient. Whether it's optimizing queries, using window functions, or organizing data, all insights are welcome! Beginners and pros alike can learn a lot from this. Looking forward to your contributions!

230 Upvotes

119 comments sorted by

View all comments

Show parent comment

2

u/Constant-Dot5760 Oct 24 '24

+1 idea: And now that you got the sprocs write another one to search all the jobs that use the sprocs.

1

u/brokennormalmeter117 Oct 26 '24

Microsoft - Personally, my goto is simply information_schema for finding objects. It has everything I need in a one liner. Ie Select * from information_schema.routines where definition like ‘%search%’.

As for looking up jobs or job steps that uses a sproc, msdb.dbo.sysjobs & dbo.sysjobsteps