Validate SP's and UDF's with checksum

,

This UDF will return the checksum for a SP or UDF to help tracking changes to the code.
Example:
print dbo.OBchecksum('hello')

CREATE function OBchecksum(@s NVARCHAR(128) ) 
returns int
as
BEGIN
declare @i int
set @i=(
SELECT     CHECKSUM_AGG (CHECKSUM(dbo.syscomments.text)) AS Expr1
FROM         dbo.syscomments INNER JOIN
                      dbo.sysobjects ON dbo.syscomments.id = dbo.sysobjects.id
WHERE     (dbo.sysobjects.name =@s)
)
return @i
END

Rate

Share

Share

Rate