sexta-feira, 7 de agosto de 2015

Alternative to syscomments

As syscomments is deprecated in recent SQL SERVER versions, I had to find an alternate way to find String fragments in Procedures, Functions and Triggers.

One alternative I discovered was the OBJECT_DEFINITION function. It takes the OBJECT_ID as an argument and It returns a NVARCHAR(MAX) value.

To locate the string 'bravo' in your database objects, you can query your SQL SERVER 2008 or newer like this;

 SELECT *, 
       Object_definition(object_id) AS Body 
FROM   sys.objects 
WHERE  Object_definition(object_id) LIKE '%bravo%' 
=)

Check out my new book about R Language http://www.amazon.com/dp/B00SX6WA06

Nenhum comentário:

Postar um comentário

Leave your comment here!