Technical Article

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

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating