One of interesting tasks I once had is to check the # of code lines for all user stored procedures (SPs) in a user database.

I once developed a pure yet lengthy t-sql solution by counting the new line ASCII code (i.e. char(0×13) + char(0×10) ).

However, with PowerShell and SMO, it is actually much easier to do so and here is a script to count # of lines and total words for all user SPs in my local SQL Server 2K8 instance (for AdventureWorks database)