Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Join count in Stored procedures

Author  Topic 

anaylor01
Starting Member

28 Posts

Posted - 2012-03-06 : 15:56:27
I want to get a count of joins in each stored procedure. Any ideas on how to do this?

X002548
Not Just a Number

15586 Posts

Posted - 2012-03-06 : 16:18:00
How's about


SELECT ROUTINE_NAME, (LEN(ROUTINE_DEFINITION) - LEN(REPLACE(ROUTINE_DEFINITION,'JOIN',''))) / 4
FROM INFORMATION_SCHEMA.ROUTINES
WHERE LEN(ROUTINE_DEFINITION) <> LEN(REPLACE(ROUTINE_DEFINITION,'JOIN',''))



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page
   

- Advertisement -