Finding a Needle in a Haystack

[av_one_full first min_height=” vertical_alignment=” space=” custom_margin=” margin=’0px’ link=” linktarget=” link_hover=” padding=’0px’ border=” border_color=” radius=’0px’ background=’bg_color’ background_color=” background_gradient_color1=” background_gradient_color2=” background_gradient_direction=’vertical’ src=” background_position=’top left’ background_repeat=’no-repeat’ animation=” mobile_breaking=” mobile_display=” av_uid=’av-g8zfzo’]
[av_heading heading=’Finding a Needle in a Haystack’ tag=’h1′ link_apply=” link=’manually,http://’ link_target=” style=’blockquote classic-quote’ size=” subheading_active=’subheading_below’ subheading_size=’15’ margin=” margin_sync=’true’ padding=’10’ color=” custom_font=” av-medium-font-size-title=” av-small-font-size-title=” av-mini-font-size-title=” av-medium-font-size=” av-small-font-size=” av-mini-font-size=” av_uid=’av-kxg6e0o7′ id=” custom_class=” admin_preview_bg=”]
Written by Michael Scalamogna, Director of Dynamics 365
[/av_heading]
[/av_one_full]

[av_one_full first min_height=” vertical_alignment=” space=” custom_margin=” margin=’0px’ link=” linktarget=” link_hover=” padding=’0px’ border=” border_color=” radius=’0px’ background=’bg_color’ background_color=” background_gradient_color1=” background_gradient_color2=” background_gradient_direction=’vertical’ src=” background_position=’top left’ background_repeat=’no-repeat’ animation=” mobile_breaking=” mobile_display=” av_uid=’av-acrhes’]

[av_image src=’https://nmq52a.p3cdn1.secureserver.net/wp-content/uploads/2021/12/SQL-Scripts.jpg’ attachment=’15524′ attachment_size=’full’ align=’center’ styling=” hover=” link=’manually,https://opalbiz.com/it-cloud/#sqlserver’ target=” caption=” font_size=” appearance=” overlay_opacity=’0.4′ overlay_color=’#000000′ overlay_text_color=’#ffffff’ copyright=” animation=’no-animation’ av_uid=’av-kskcv8mv’ id=” custom_class=” admin_preview_bg=”][/av_image]

[av_hr class=’invisible’ height=’25’ shadow=’no-shadow’ position=’center’ custom_border=’av-border-thin’ custom_width=’50px’ custom_border_color=” custom_margin_top=’30px’ custom_margin_bottom=’30px’ icon_select=’yes’ custom_icon_color=” icon=’ue808′ font=’entypo-fontello’ av_uid=’av-kqjt1j8o’ id=” custom_class=” admin_preview_bg=”]

[av_image av_uid=’av-ieu6wv’][/av_image]

[av_textblock size=” font_color=” color=’#000000′ av-medium-font-size=” av-small-font-size=” av-mini-font-size=” av_uid=’av-ubkg3g’ id=” custom_class=” admin_preview_bg=”]
Earlier today we encountered an issue where one SQL table in a data warehouse was not being updated. We were tasked with finding the one line of code out of tens of thousands of lines of code that might be updating this table to troubleshoot.

I wanted to share the SQL scripts that I used to find where the table was being referenced. There are two:

The first script searches the text of all SQL server stored procedures for a specific word or phrase. If you run this, make sure to keep the “%” symbols. Run this against a specific database.

SELECT DISTINCT

o.name AS Object_Name,

o.type_desc

FROM sys.sql_modules m

INNER JOIN

sys.objects o

ON m.object_id = o.object_id

WHERE m.definition Like ‘%ENTER YOUR TEXT HERE%’;


The second script searches all job steps for a specific word or phrase. Run this against the MSDB database:

SELECT Job.name          AS JobName,

Job.enabled       AS ActiveStatus,

JobStep.step_name AS JobStepName,

JobStep.command AS JobCommand

FROM   sysjobs Job

INNER JOIN sysjobsteps JobStep

ON Job.job_id = JobStep.job_id

WHERE  JobStep.command LIKE ‘%ENTER YOUR TEXT HEREt%’


These scripts make an otherwise tedious job quite fast. Please contact Opal Business Solutions, a Microsoft Gold Partner, for more handy SQL scripts. Try it out!
[/av_textblock]

[/av_one_full][av_hr class=’invisible’ height=’25’ shadow=’no-shadow’ position=’center’ custom_border=’av-border-thin’ custom_width=’50px’ custom_border_color=” custom_margin_top=’30px’ custom_margin_bottom=’30px’ icon_select=’yes’ custom_icon_color=” icon=’ue808′ font=’entypo-fontello’ av_uid=’av-kqjt1j8o’ id=” custom_class=” admin_preview_bg=”]

[av_button label=’Contact Us’ link=’manually,https://opalbiz.com/it-cloud/#sqlserver’ link_target=” size=’x-large’ position=’center’ label_display=” title_attr=” icon_select=’no’ icon=’ue800′ font=’entypo-fontello’ color=’theme-color’ custom_bg=’#444444′ custom_font=’#ffffff’ av_uid=’av-jiak8jn0′ id=” custom_class=” admin_preview_bg=”]

Related News