c;0??ACGKOSSSSSW[_cj}+z_#` @s080X90000Ѐ000000 0L30(@000K 0`K 0080X90P0X/ / 00Л0 0000 0>00:00&0,"0Л0000Л0000Л0000Л0000000000000000008800K0s0n0000000spЂ0erver_0fo@att0bute_iH0@080? 0K000T00int000}(@0X}(@0Л0}(@0buhC}(@0000B00F0buteЃ0d(@0 0d000/00(@0ȿ/(@00(@0p0(@08h0|`0(@0H0/(@0/|X0(@00(@00 00(@00}(@088 (@0@0(@0ȑ0@D}(@00}(@0hh }(@0hh 0(@0X0(@00(@00|(0}0 00(@0ޏ `0(@08@0(@08P0|0|ȓ0|Г0 @D}(@00(@0ؓ0}(@088 ~(@0hh@D}(@0X0(@00 }(@0hh}(@00(@0@0@}(@0@0G}(@00(@000PH 04000 |(@00P0|00000 |(@00P0&  |(@00dO0 |(@0(0N0 l00 |(@0@0N00 0Љ0 |(@00`M0((F |(@00L0\0`0p0 |(@0p0 L0000 |(@0ؗ0\K0@ |(@00I0`0 |(@00@A0 |(@0Ї0A0dconfig0@0((440 80conf88 `0@0(88 @0h00L00e04000$D0$0 @00( 00/̌???0/?@@@F@0(@0`0|X0̌???`x8w}(@0 0-00masterdbospT0se 0er_infomasterdboH0pt_serH/z0Л044440000H/z000s0hn0000^H8000((/z$0@0d_000R0@R0/ 0x/ 0/X//8/S0ptal0000Q0(Q0P0Л0 0000P0P0Q0R0xR0Q0R0xR0@R0R0gu`Q0s0 0`0er//ysP0P00urЛ0 0S 00Л0 00H0cP0T2 0 0hh`0h0A0 00A0 0@0 00p00880(0Л000erЛ0ur00ؑ0000000xS00?0??00@0H0p0`00`08000X00na?0(0000 00P0000000В0000000000080000?00x000?0??00000Л00/000(X/}/0J0@|(@0(@0`E0J0}(@0@0J0}(@0X0J0}00 J0@|(@0(@00 J0@|(@0(@0 F0J0}(@0J0@|(@0(@0`F0J0@|(@0(@0F0J0ư>??ư>@|(@0(@0 G0@|(@0(@003z0 0hh}(@0@|(@0(@00(@|(@0(@0Б0@|(@0(@0p0sy}0000x0@|(@0(@0P0on}p0h0`0X0P00G0G0G0 t0config}(@088 8}(@088 8ve}(@0@0(000@0attrib0e_id0((88 @00attribute_id0p0pe0И0000`0000 0P00000}}(@0@00}}(@0@000zp0088 и00 00D000P00T00/H0/L0`@ /44 0d@?0 0>@ 0@?P 0>` 0[@?p 0> 0N@? 0> 0M@? 0(T!{ 0 0Ѐ 0(0 0 0a@ 0> 0C@? 0> 0@@?@0 0>@ 0?@??P 0>` 0>@?@p 0> 0=@?@ 0T!{H 0 0 0Q0 0(؁ 0 0a@ 0Ё 0> 0:@?@ 0> 09@?? 0> 08@?@0 0>@ 07@?@P 0>` 06@ 0p 0!P8z 0H 0 0 0F 0Cz  0 0 0F 00@ 0@Ђ 0 02@| 0 0 08z  0 0 0 088 0P 0  00 0 0@ 0P8zP 0 00 0` 0Fp 0H;z 0\ 0@ 0 0| 0` 0H 0 0 0 0ptL@@Ѓ 0 0 0 0Ѓ 0a 0 0JJJ$% 0JJJ$%( 0`P@ 0|LX 0 0p 0|L 0~0 0 0@L 0|LЄ 0c0 0@L 0`:MJ 0AM 0AMJ0 0 MH 0|L` 00 0AMx 0|L 0`0, 0F 0@L 00؅ 0@L 0J AD 0 AMJ 0J |L8 0D 0P 0@Lh 0|L 0P 0@L 0`:MJ 0p{L`Ȇ 0 0C 0 0!% 0 0 0% 0 0!C 0 0 0% 0 0!% 0 0( 0% 0 0!% 0 0@ 0P!{(0(X 0(0@ 0̀ 0p 0 0 0 0` 0 0(0Ї 0(@ 0hh 0(@ 088 0(@ 0 0 0P 0` t 0d 0X 0hhptL 0 0 0!$%J1`zL|L@ 00( 0F@L|L04 0 0@L`:MJ\D% 0 0 0% 0 0!@P!{(0(d 0(0@ 0 0 0@ 0 0 0 00 0 0 0@ 0 0@|(0 0 0U0 0@ 0 0 0 0 0 0 0 0` 0P 0@ 00 0H4zh 0 088Љ 0 0pL 0 0H 0BK) 0 0 0 0P5z 0 00>`̊ 0 0hhp 0XzL|L8 00LB 0(@ 0 0L 0 0` 00@l 0 0(@ 0؏ 0 0\` 0(@ 0Ї 00x8;@ 0(x؏ 0 8@q80x88 80 00 0 H 0, 0@ 040x 080x 0h 0q 0 0 0T 0 0P6L 0 0 0, 0 080x88 8`< 00x88 800q80x 0 80p 0q 0 0 0 0p 0hU 0 0 0X 0L 0 0 0(0x 0 0Ѝ 0H 0P 3Ѝ 0 0V 088  0``w/88 0 xH`w2H 0V 088 A``w/p 088 z0.P 03V 0hh 0 0 0 0@, 0 0 0` 0L 00(0E 0 0!Pj@configc8 0nt0P 010Ȋ 0` 0 0D 0W 0hh 0HL 0 0_ 0(0 0(@ 088 0P _b02 mystem IS NOT NULL) OR (@command IS NOT NULL) OR (@cmdexecsuccesscode IS NOT NULL) OR (@server IS NOT NULL) OR (@databasename IS NOT NULL) OR (@username IS NOT NULL) OR (@retryattempts IS NOT NULL) OR (@retrydelay IS NOT NULL) OR (@runpriority IS NOT NULL) BEGIN EXECU@E @retval = sp_update_jobstep @job_id = @job_id, @step_id = 1, @subsystem = @subsystem, @command = @command, @cmdexec_success_code = @cmdexecsuccesscode, @server = @server, @database_name = @databasename, @database_user_name = @username, @retry_attempts = @retryattempts, @retry_interval = @retrydelay, @os_run_priority =@@runpriority IF (@retval <> 0) BEGIN ROLLBACK TRANSACTION GOTO Quit END END -- Now update the job itself IF (@name IS NOT NULL) OR (@enabled IS NOT NULL) OR (@description IS NOT NULL) OR (@loghistcompletionlevel IS NOT NULL) OR (@emailcompletionlevel IS NOT NULL) OR (@emailoperatorname IS NOT NULL) BEGIN EXECUTE @retval = sp_update_job @jo@_id = @job_id, @new_name = @name, @enabled = @enabled, @description = @description, @notify_level_eventlog = @loghistcompletionlevel, @notify_level_email = @emailcompletionlevel, @notify_email_operator_name = @emailoperatorname IF (@retval <> 0) BEGIN ROLLBACK TRANSACTION GOTO Quit END END -- Finally, update the job sch@dule IF (@freqtype IS NOT NULL) OR (@freqinterval IS NOT NULL) OR (@freqsubtype IS NOT NULL) OR (@freqsubinterval IS NOT NULL) OR (@freqrelativeinterval IS NOT NULL) OR (@freqrecurrencefactor IS NOT NULL) OR (@activestartdate IS NOT NULL) OR (@activeenddate IS NOT NULL) OR (@activestarttimeofday IS NOT NULL) OR (@activeendtimeofday IS NOT NULL) BEGIN IF (@freqtype = 0x2) @ BEGIN -- OnDemand tasks simply have no schedule in 7.0, so delete the job schedule EXECUTE @retval = sp_delete_jobschedule @job_id = @job_id, @name = N'6.x schedule' END ELSE BEGIN IF (NOT EXISTS (SELECT * FROM msdb.dbo.sysjobschedules WHERE (job_id = @job_id) AND (name = N'6.x schedule'))) EXECUTE @retval = sp_add_jobschedule @jo@_id = @job_id, @name = N'6.x schedule', @enabled = 1, @freq_type = @freqtype, @freq_interval = @freqinterval, @freq_subday_type = @freqsubtype, @freq_subday_interval = @freqsubinterval, @freq_relative_interval = @freqrelativeinterval, @freq_recurrence_factor = @freqrecurrencefactor, @active_start_date = @acti@estartdate, @active_end_date = @activeenddate, @active_start_time = @activestarttimeofday, @active_end_time = @activeendtimeofday ELSE EXECUTE @retval = sp_update_jobschedule @job_id = @job_id, @name = N'6.x schedule', @enabled = 1, @freq_type = @freqtype, @freq_interval = @freqinterval, @ h/02 m/@freq_subday_type = @freqsubtype, @freq_subday_interval = @freqsubinterval, @freq_relative_interval = @freqrelativeinterval, @freq_recurrence_factor = @freqrecurrencef@actor, @active_start_date = @activestartdate, @active_end_date = @activeenddate, @active_start_time = @activestarttimeofday, @active_end_time = @activeendtimeofday END @ IF (@retval <> 0) BEGIN ROLLBACK TRANSACTION GOTO Quit END END COMMIT TRANSACTION Quit: RETURN(@retval) -- 0 means success END P  fP HP  P !!4/4@fe`p sjv.notify_level_netsend, sjv.notify_level_page, sjv.notify_email_operator_id, sjv.notify_netsend_operator_id, sjv.notify_page_operator_id, sjv.delete_level, has_step = (SELECT COUNT(*)  vb eb TP$D c(A-Wnf{nLb04sp_droptask_dtCC90&-Wn9@namedesTD6-Wn@name W|DC0&-WnC@loginname \@$6-Wn$@loginnamepE50&-Wn88 5@idP6-Wn@idP> O-Wn0P ?  -Wn00P >  -Wn0P@ A  -Wn`MSP A  -Wn`MSP A  -Wn`MSTC  -WnPD -Wnc5U PA -Wn0 PF @-WnX -Wn4+\H0*-WnP b04 Hsp_droptask\&]$6-Wn$sp_droptaskD!^ -WnH/b04SplitNextD a/@L@_L_42L_dL0Ie-WnP  4b040\ ! 0-Wn! CREATE @ROCEDURE sp_droptask @name sysname = NULL, -- Was VARCHAR(100) in 6.x @loginname sysname = NULL, -- Was VARCHAR(30) in 6.x @id INT = NULL AS BEGIN DECLARE @retval INT DECLARE @job_id UNIQUEIDENTIFIER DECLARE @category_id int SET NOCOUNT ON IF ((@name IS NULL) AND (@id IS NULL) AND (@loginname IS NULL)) OR ((@name IS NOT NULL) AND ((@id IS NOT NULL) OR (@loginname IS NOT NULL))) OR ((@id IS NOT NULL) AND ((@name IS NOT @ULL) OR (@loginname IS NOT NULL))) OR ((@loginname IS NOT NULL) AND ((@name IS NOT NULL) OR (@id IS NOT NULL))) BEGIN RAISERROR(14245, -1, -1) RETURN(1) -- Failure END -- If the name is supplied, get the job_id directly from sysjobs IF (@name IS NOT NULL) BEGIN -- Check if the name is ambiguous IF ((SELECT COUNT(*) FROM msdb.dbo.sysjobs_view WHERE (name = @name)) > 1) BEGIN RAISERROR(14292, -1, -1, @name, '@id', '@name') @ RETURN(1) -- Failure END SELECT @job_id = job_id, @category_id = category_id FROM msdb.dbo.sysjobs_view WHERE (name = @name) SELECT @id = task_id FROM msdb.dbo.systaskids WHERE (job_id = @job_id) IF (@job_id IS NULL) BEGIN RAISERROR(14262, -1, -1, '@name', @name) RETURN(1) -- Failure END END -- If the id is supplied lookup the corresponding job_id from systaskids IF (@id IS NOT NULL) BEGIN SELECT @job_id = job_id @ FROM msdb.dbo.systaskids WHERE (task_id = @id) -- Check that the job still exists IF (NOT EXISTS (SELECT * FROM msdb.dbo.sysjobs_view WHERE (job_id = @job_id))) BEGIN SELECT @name = CONVERT(NVARCHAR, @id) RAISERROR(14262, -1, -1, '@id', @name) RETURN(1) -- Failure END -- Get the name of this job SELECT @name = name, @category_id = category_id FROM msdb.dbo.sysjobs_view WHERE (job_id = @job_id)@ END -- Delete the specific job IF (@name IS NOT NULL) BEGIN BEGIN TRANSACTION DELETE FROM msdb.dbo.systaskids WHERE (job_id = @job_id) EXECUTE @retval = sp_delete_job @job_id = @job_id IF (@retval <> 0) BEGIN ROLLBACK TRANSACTION GOTO Quit END -- If a Logreader or Snapshot task, delete corresponding replication agent information IF @category_id = 13 or @category_id = 15 BEGIN EXECUTE @retval = sp_MSdrop_6x_replication_agent @job_id, @c@tegory_id IF (@retval <> 0) BEGIN ROLLBACK TRANSACTION GOTO Quit END END COMMIT TRANSACTION END -- Delete all jobs belonging to the specified login IF (@loginname IS NOT NULL) BEGIN BEGIN TRANSACTION DELETE FROM msdb.dbo.systaskids WHERE job_id IN (SELECT job_id FROM msdb.dbo.sysjobs_view WHERE (owner_sid = SUSER_SID(@loginname))) EXECUTE @retval = sp_manage_jobs_by_login @action = 'DELETE', @ @current_owner_login_name = @loginname IF (@retval <> 0) BEGIN ROLLBACK TRANSACTION GOTO Quit END COMMIT TRANSACTION END Quit: RETURN(@retval) -- 0 means success END perP  P  P! ! PH" "4b04́C0HX x ( Dl(L,<HXHp\ sjv.description FROM msdb.dbo.sysjobs_view sjv, msdb.dbo.sysjobservers sjs WHERE ((@job_id IS NULL) OR (@job_id = sjv.job_id)) AND (sjv.job_id = sjs.job_id) AND (sjs.server_id = @server_id) ORDER BY sjv.job_id RETURN(@@error) -- 0 means success END < a NPPR46)D c(Af{noLC14sp_helptask|)FA0&f{nA@taskname\)"6f{n"@tasknameIQx)G)=0&f{n88 =@taskidbleX@)6f{n@taskidxJ|)H)C0&f{nC@loginnamew\))$6f{n$@loginname)I)I0&f{nI@operatornamehe d) )*6f{n*@opera@ornameN'|) J) C0&f{nPC@subsystem \) ) $6f{n$@subsystemt) K) 90&f{n 9@modethaT) ) 6f{n@mode P)G f{n#,000@P)G )f{n#, P)G )f{n0 P)G )f{n0 P)G )f{n0  -P)G )f{n0 = 0P)G )f{n0  P)G@)f{n0 P)G )f{n0ax_P)G )f{n0eckP)G )f{n0totP)G )f{n0e rP)S )f{n P)S )f{n@ P)Q )f{n P)Q )f{n P)Q )f{nD P)Q )f{n db.P) Q ) f{n ldeP)!Q )!f{n us P)"@Q )"f{n urrP)#Q )#f{n ERTP)$Q )$f{nE (P)%Q )%f{nROWP)&Q )&f{nstaP)'Q )'f{nd =P)(Q )(@f{n P))Q ))f{n P)*Q )*f{n[ystaP)+Q )+f{n[yf iP),Q ),f{n[yws P)-Q )-f{n[y SEP).Q ).f{n[yete@P)/Q )/f{n[y BEP)0Q )0f{n[y P)1Q )1f{n[y P)2Q )2f{n[yCTP)3Q )3f{n[y P)4Q )4f{n[y P)5Q@)5f{n[y P)6Q )6f{n[yTEP)7Q )7f{n"U P)8Q )8f{n"UidP)9Q )9f{n"U P):Q ):f{n"U SP);Q );f{n@U )<f{n4)=,H0*f{nP G14 Hsp_helptask\)>:$6f{n$sp_helptaskD)?! f{n)@0f{nCREATE PROCEDURE sp_helptask @taskname sysname = NULL, -- Was VARCHAR(100) in 6.x @t@skid INT = NULL, @loginname sysname = NULL, -- Was VARCHAR(20) in 6.x @operatorname sysname = NULL, -- Was VARCHAR(50) in 6.x @subsystem NVARCHAR(40) = NULL, -- Was VARCHAR(30) in 6.x @mode VARCHAR(10) = 'QUICK' -- Or 'FULL' AS BEGIN DECLARE @operator_id INT DECLARE @owner_sid VARBINARY(85) SET NOCOUNT ON -- Convert old replication synchronization subsystem name to the 7.0 name IF (LOWER(@subsystem) = N'sync') SELECT @subsyste@ = N'Snapshot' -- Get the login id for the login name (if supplied) IF (@loginname IS NOT NULL) BEGIN IF (ISNULL(IS_SRVROLEMEMBER(N'sysadmin'), 0) = 0) AND (SUSER_SNAME() <> @loginname) BEGIN RAISERROR(14247, -1, -1) RETURN(1) -- Failure END SELECT @owner_sid = SUSER_ID(@loginname) IF (@owner_sid IS NULL) BEGIN RAISERROR(14234, -1, -1, '@loginname', 'sp_helplogins') RETURN(1) -- Failure END END -- Get the operator id for th@ operator name (if supplied) IF (@operatorname IS NOT NULL) BEGIN SELECT @operator_id = id FROM msdb.dbo.sysoperators WHERE (name = @operatorname) IF (@operator_id IS NULL) BEGIN RAISERROR(14262, -1, -1, '@operatorname', @operatorname) RETURN(1) -- Failure END END -- Check the mode SELECT @mode = UPPER(@mode) IF (@mode NOT IN ('FULL', 'QUICK')) BEGIN RAISERROR(14266, -1, -1, '@mode', 'FULL, QUICK') RETURN(1) -- Failure END @ -- Return task details... -- NOTE: SQLOLE and Starfighter rely on the 'FULL' mode format - do not change it! IF (@mode = 'FULL') BEGIN SELECT name = sjv.name, id = sti.task_id, subsystem = sjst.subsystem, server = sjst.server, username = sjst.database_user_name, ownerloginname = SUSER_SNAME(sjv.owner_sid), databasename = s@st.database_name, enabled = sjv.enabled, freqtype = ISNULL(sjsch.freq_type, 2), -- On Demand freqinterval = ISNULL(sjsch.freq_interval, 0), freqsubtype = ISNULL(sjsch.freq_subday_type, 0), freqsubinterval = ISNULL(sjsch.freq_subday_interval, 0), freqrelativeinterval = ISNULL(sjsch.freq_relative_interval, 0), freqrecurrencefactor = ISNULL(sjsch.freq_recurrence_fact@r, 0), activestartdate = ISNULL(sjsch.active_start_date, 19900101), activeenddate = ISNULL(sjsch.active_end_date, 99991231), activestarttimeofday = ISNULL(sjsch.active_start_time, 0), activeendtimeofday = ISNULL(sjsch.active_end_time, 235959), lastrundate = sjs.last_run_date, lastruntime = sjs.last_run_time, nextrundate = ISNULL(sjsch.next_run_date, 0), next@untime = ISNULL(sjsch.next_run_time, 0), runpriority = sjst.os_run_priority, emailoperatorname = so.name, retryattempts = sjst.retry_attempts, retrydelay = sjst.retry_interval, datecreated = sjv.date_created, datemodified = sjv.date_modified, command = sjst.command, lastruncompletionlevel = sjs.last_run_outcome, lastr@nduration = sjst.last_run_duration, lastrunretries = sjst.last_run_retries, loghistcompletionlevel = sjv.notify_level_eventlog, emailcompletionlevel = sjv.notify_level_email, description = sjv.description, tagadditionalinfo H/G14SplitNext8)B B0L)C /@D)D )D/@8)E /Bx8L)F_L)G)A_L)H_L)I0Jf{nP)J  #@4)BG14)B0 )A)G{ 0f{n{ = 0, tagobjectid = 0, tagobjecttype = 0, cmdexecsuccesscode = sjst.cmdexec_success_code FROM msdb.dbo.sysjobs_view sjv LEFT OUTER JOIN msdb.dbo.sysoperators so ON (sjv.notify_email_operator_id = so.id) LEFT OUTER JOIN msdb.dbo.systaskids sti ON (sjv.job_id @ sti.job_id) LEFT OUTER JOIN msdb.dbo.sysjobschedules sjsch ON (sjv.job_id = sjsch.job_id), msdb.dbo.sysjobsteps sjst, msdb.dbo.sysjobservers sjs WHERE (sjv.job_id = sjst.job_id) AND (sjst.step_id = 1) AND (sjv.job_id = sjs.job_id) AND (sjs.server_id = 0) AND ((sjsch.name = N'6.x schedule') OR (sjsch.name IS NULL)) -- NULL handles the case of the job not having a schedule AND ((@owner_sid IS NUL@) OR (sjv.owner_sid = @owner_sid)) AND ((@subsystem IS NULL) OR (sjst.subsystem = @subsystem)) AND ((@operator_id IS NULL) OR (sjv.notify_email_operator_id = @operator_id)) AND ((@taskname IS NULL) OR (sjv.name = @taskname)) AND ((@taskid IS NULL) OR (sti.task_id = @taskid)) ORDER BY sj.name END ELSE BEGIN SELECT name = SUBSTRING(sjv.name, 1, 20), id @= sti.task_id, subsystem = SUBSTRING(sjst.subsystem, 1, 15), server = SUBSTRING(sjst.server, 1, 20), username = SUBSTRING(sjst.database_user_name, 1, 20), dbname = SUBSTRING(sjst.database_name, 1, 20), enabled = sjv.enabled FROM msdb.dbo.sysjobs_view sjv LEFT OUTER JOIN msdb.dbo.systaskids sti ON (sjv.job_id = sti.job_id), msdb.dbo.sysjobsteps sjst WHERE (sjv.job_id = sjst.job_id)@ AND (sjst.step_id = 1) AND ((@owner_sid IS NULL) OR (sjv.owner_sid = @owner_sid)) AND ((@subsystem IS NULL) OR (sjst.subsystem = @subsystem)) AND ((@operator_id IS NULL) OR (sjv.notify_email_operator_id = @operator_id)) AND ((@taskname IS NULL) OR (sjv.name = @taskname)) AND ((@taskid IS NULL) OR (sti.task_id = @taskid)) ORDER BY sjv.name END END P)M @ )KP)N )NP)O )O .=P)P )P4)G14) 0322@21<(('l' '&&P& &%%@%P 0p 0@P`p  0 @ P `  p 0@P\(PH\_X code @run_date INT, @run_time INT, @run_duration INT, @operator_id_emailed INT = 0, @operator_id_netsent INT = 0, @operator_id_paged INT = 0, @retries_attempted INT, @server NVARCHAR(30) = N'(local)' AS BEGIN DECLARE @retval INT DECLARE @job_id_as_char VARCHAR(36) DECLARE @step_id_as_char VARCHAR(10) DECLARE @operator_id_as_char VARCHAR(10) DECLARE @step_$ L=uroj ema" ˕ t)Xz6D`014SQLServerAgent can add a history entry for a job) EXECUTE @retval = sp_verify_jobproc_caller @job_id = @job_id, @program_name = N'SQLAgent%' IF (@retval <> 0) RETURN(@retval) -- NOTE: We raise all errors as informational (sev 0) to prevent SQLServerAgent from caching -- the operation (if it fails) since if the operation will never run successfully we -- XED14DLdbo.sysjobs_view WHERE (job_id = @job_id))) BEGIN SELECT @job_id_as_char = CONVERT(VARCHAR(36), @job_id) RAISERROR(14262, @error_severity, -1, 'Job', @job_id_as_char) RETURN(1) -- Failure END -- Check step id IF (@step_id <> 0) -- 0 means 'for the whole job' BEGIN SELECT @step_name = step_naXzF`D14) BEGIN SELECT @step_id_as_char = CONVERT(VARCHAR, @step_id) RAISERROR(14262, @error_severity, -1, '@step_id', @step_id_as_char) RETURN(1) -- Failure END END ELSE SELECT @step_name = FORMATMESSAGE(14570) -- Check run_status IF (@run_status NOT IN (0, 1, 2, 3, 4, 5)) -- SQLAGENT_EXEC_X code BEGIN RAISERROR(14266, @error_severity, XGF14FL\H0 IF (@retval <> 0) RETURN(1) -- Failure -- Check run_time EXECUTE @retval = sp_verify_job_time @run_time, '@run_time', 10 IF (@retval <> 0) RETURN(1) -- Failure -- Check operator_id_emailed IF (@operator_id_emailed <> 0) BEGIN IF (NOT EXISTS (SELECT * FROM msdb.dbo.sysoperators P HD c)(AopT24sp_verifytaskid1,xHL) =0&o88 =@taskidnetXH)6o@taskid |HMHC0&oPC@subsysteme\@HH$6o$@subsystemPHu )<o0FaiPHv Ho[yd <PHv Ho[yo.sPH x H o PH x H o R H @oH -)>P0*oP 24 Psp_verifytaskiddH f)?,6o,sp_verifytaskidDH!)@ o8H)M0oCREATE PROCEDURE sp_verifytaskid @taskid INT, @subsystem NVARCHAR(40) = N'%' AS BEGIN SET NOCOUNT ON -- @onvert old replication synchronization subsystem name to the 7.0 name IF (LOWER(@subsystem) = N'sync') SELECT @subsystem = N'Snapshot' -- Check if the task [job] exists IF (EXISTS (SELECT * FROM msdb.dbo.sysjobs_view sjv, msdb.dbo.sysjobsteps sjst, msdb.dbo.systaskids sti WHERE (sjv.job_id = sjst.job_id) AND (sjv.job_id = sti.job_id) AND (sti.task_id = @taskid) AND (LO@ER(sjst.subsystem) LIKE LOWER(@subsystem)))) RETURN(0) -- Success ELSE RETURN(1) -- Failure END PH  )QPH HPH H PH H4H24H́C0 `  p8HH(\ @operator_id_netsent, @operator_id_paged, @retries_attempted, @server) -- If misc. replication job, then update global replication status table SELECT @job_name = name from msdb.dbo.sysjobs where job_XWCP6ln ND cH(ApqT34sp_reassigntaskE|NNHA0&pA@tasknamey \NH"6p"@taskname.H/34SplitNextDN )E@/li@shLN&SLNNS  LNS7m |N N5GSKE?]YGSGKEU9C5A=CIC9=CA=7;=39;;=97=GEGigcIGCCSQMIGC0&2 m88 G@runpriorityi0&2 m@S@emailoperatornamew0&2 m88 K@retryattempts 0&2 m88 E@retrydelay0&2 m?@command0&2 m88 ]@loghistcompletionlevel0&2 m88 Y@emailcompletionlevel0&2 mG@descri@ption0&2 m`S@tagadditionalinfo0&2 m88 G@tagobjectid0&2 m88 K@tagobjecttype 0&2 m##  E@parameters IF0&2 m88 !!U@cmdexecsuccesscodescr0&-Wn9@nameCT 0&-WnC@@loginname0&-Wn88 5@id0&f{nA@taskname:0&f{n88 =@taskid0&f{nC@loginname0&f{nI@operatornameer0&f{nPC@subsystem0&f{n 9@modee0&o88 @=@taskid0&oPC@subsystem0&pA@tasknamer0&:s88 =segmentH0&:s 7name0&:s88 ;status0&^t88 =constid/0&^t88 3id0&^t449c@olid0&^t00;spare10&^t88 ;status0&^t88 =actions0&^t88 9error0&u447suids0&u44=altsuid (0&XvGCATALOG_NAME 0&XvESCHEMA_NA@MEge0&XvGSCHEMA_OWNER 0&XviDEFAULT_CHARACTER_SET_CATALOGda0&XvgDEFAULT_CHARACTER_SET_SCHEMA 0&XvcDEFAULT_CHARACTER_SET_NAME_0&˿wITABLE_CATALOGag0&˿w@GTABLE_SCHEMA 0&˿wCTABLE_NAMEi0&˿w CTABLE_TYPE 0&xSCONSTRAINT_CATALOG 0&xQCONSTRAINT_SCHEMAsa0&xMCONSTRAINT_NAME @0&xITABLE_CATALOG 0&x@GTABLE_SCHEMAr0&xCTABLE_NAMEa<N 6N5Fx8LN :2 maPN H4N34N05NN I0&pI@newloginname@nadNN*6p*@newloginnamenNNI0&pI@oldloginnameT H/34SplitNextDN N/wo@rrLN LNN@_tPN N LNVMb 'NNZ*$&"2&* ,60:(,6 *(:4 *::0(">((&,&($4(,",60:6 (*(:4 *::0(">((&,&($4(,"$$*$"$*"6I0j*retryattempts 6I0j$retrydelay6I0j&runp@iorityg6I0jserver6I0j"subsystem 6I0j$2tagadditionalinfow6I0j%&tagobjectid 6I0j&*tagobjecttype06I0j username6$k@seed 6l,@activeenddate6l6@activeendtimeofday6l 0@activestartdate6l:@activestarttimeofday6l"(@categ@ry_id6l!,@category_name6l 6@cmdexecsuccesscodesp6l @command6l*@databasename B6l(@description6l:@emailcompletionlevelrs6l4@emailoperatorname6l @enabled6l*@freqinterval 6l :@freqrecurrencefactor 6l :@freqrelat@veintervalVE6l 0@freqsubinterval6l (@freqsubtype6l"@freqtypeCO6l>@loghistcompletionlevelNA6l@name/ 6l@newid6l(@nextrundate6l(@nextruntime6l&@parametersT(6l,@retryattempts6l&@retrydelayft6l(@runpriority@l@server 6l$@subsystem6l4@tagadditionalinfo6l(@tagobjectid6l,@tagobjecttype6l"@usernameft62 m,@activeenddate62 m6@activeendtimeofday1)62 m0@activestartdate62 m:@activestarttimeofday62 m!6@cmdexecsuccesscode62 m@ @command62 m(@currentname62 m*@databasename62 m(@description62 m:@emailcompletionlevel 62 m4@emailoperatorname62 m @enabled62 m *@freqinterval 62 m:@freqrecurrencefactorio62 m :@freqrelativeintervalif62 m 0@freqsubinterval62 m @(@freqsubtype62 m "@freqtype62 m@id`f62 m>@loghistcompletionlevell62 m@names62 m(@nextrundate62 m(@nextruntime62 m &@parametersr62 m,@retryattempts62 m&@retrydelay(62 m(@runpriority62 m@server62 m$@subsystem62 m4@tagadditionalinfo62 m(@tagobjectid62 m,@tagobjecttype62 m"@usernameJ6-Wn@idK6-Wn$@loginname6-Wn@namet6f{n$@loginname6f{n@mode6f{n*@operatornamev6f{n$@subsystem6f{n@taskidle6f{n"@taskname6o$@subsystem6o@t@skid6p*@newloginname6p"@tasknamej<N [NZxx8hN# VP.6I0j.retryattemptsgPN N4N34N0ZdNYN*6p*@oldloginnamePN@z H p*ATPN{ NpX NpN .H P0*pP 34 Psp_reassigntaskH/34SplitNextDN" N/`LN# U44@LN$8N%N%040<:6$@&2.<,"2.*>B"<<D>:2(>840:DH@$DJfH@0BBDB.6$240,6@$<@<((D84B:24F0BHHFHB28<&$>02(80TD(2(2@2>804,( *(("$*",( *4"&(&,($"."&*$($D8.8"(0.0.65I0CHECK_CONSTRAINTS6u\{4COLUMN_@OMAIN_USAGE6|0COLUMN_PRIVILEGES6<8zCOLUMNS6=~1<CONSTRAINT_COLUMN_USAGE6Z=:CONSTRAINT_TABLE_USAGE t6Z36default_current_dateL 6{ $default_one6!@default_sdl_error_message6W&default_zerouc6 l~2DOMAIN_CONSTRAINTS 6x}DOMAINS6Y`.K@Y_COLUMN_USAGE0,6U<REFERENTIAL_CONSTRAINTS6XvSCHEMATAGE6 5,sp_add_category6`MS"sp_add_job, 6M2sp_add_jobschedule_z6}:@.sp_add_jobserver t6EG*sp_add_jobstep =6{/>sp_add_targetservergroupng6_2Bsp_add_targetsvrgrp_memberme6l"sp_addtas@T 6G:Y<sp_apply_job_to_targets67_<sp_check_for_owned_jobs6\`Dsp_check_for_owned_jobsteps6[>sp_convert_jobid_to_char 6c(:sp_delete_all_msx_jobs 6|F72sp_delete_categoryis6c5U(sp_delete_job6n'>sp_delete_job_referencesar6FpP8sp_delete_job@chedule6.A4sp_delete_jobserver6I0sp_delete_jobstep69:sp_delete_targetserverLL6H0Dsp_delete_targetservergroup63Hsp_delete_targetsvrgrp_member6A%@sp_downloaded_row_limiter6-Wn$sp_droptask6a DDsp_enum_sqlagent_subsystems6^KK*Jsp_gene@ate_server_description6%'W)fsp_generate_target_server_job_assignment_sqll6^Hsp_get_chunked_jobstep_params6)V@sp_get_composite_job_info6Z0sp_get_job_alerts6eEBsp_get_jobstep_db_username6Bsp_get_message_description6)?KDsp_get_schedu@e_description6 '-Bsp_get_sqlagent_propertiesX6j8.sp_help_category"6(C6sp_help_downloadlist6W$sp_help_job6DhF?2sp_help_jobhistorye6eQ4sp_help_jobschedule6"B0sp_help_jobserver6J,sp_help_jobstep6':6sp_help_targetserver6&m1@sp_he@p_targetservergroup6f{n$sp_helptask6)"<sp_is_sqlagent_starting6b@sp_jobhistory_row_limiter6X<sp_manage_jobs_by_login6Г3,(sp_msx_defect6o?+(sp_msx_enlist6YTgDsp_multi_server_job_summary6zz&8sp_post_msx_operation6i<4sp_purge_jobhisto@y6^YBsp_remove_job_from_targets6`u;:sp_resync_targetserver 6@P2sp_sem_add_message6yt4sp_sem_drop_message6$ Fsp_sem_get_perf_counter_help6e5`f0sp_set_local_time6B.Bsp_set_sqlagent_properties6wdHsp_sqlagent_check_msx_version6Hs@_sqlagent_get_perf_counters6 Fsp_sqlagent_get_startup_info6,Hsp_sqlagent_has_server_access6ȃcBsp_sqlagent_log_jobhistory6]!2sp_sqlagent_notifyR6,le8sp_sqlagent_probe_msx6Ha<sp_sqlagent_refresh_job6+\&sp_start_jobL6d]$sp_stop_job@}Hh>sp_target_server_summaryn6$k0sp_uniquetaskname6C"62sp_update_category 6*AT(sp_update_job6 |O8sp_update_jobschedule6~H0sp_update_jobstep6ԫNTsp_update_replication_job_parameter6$0Dsp_update_targetservergroup62 m(sp_updatetask64@sp_verify_categoryH62sp_verify_job_time@6r$>sp_verify_jobproc_caller 6bcL8sp_verify_jobschedule6 F0sp_verify_jobstep6AD4sp_verify_subsystem6o,sp_verifytaskid@ (sqlagent_info6v8 sysalerts6b*sysallocationsa6u(sysalternates6s(syscategories6"syscolumnsN6$syscomments6^t*sysconstraintse6 "sysdependse6> ,sysdownloadlist6`(sysfilegroups6_sysfiles_6 sysfiles16*s@sforeignkeysU64sysfulltextcatalogs6"sysindexesI6&sysindexkeyst6w (sysjobhistory6 sysjobs60&sysjobs_viewu6,sysjobschedules6"U(sysjobservers6[y$sysjobsteps6"sysmemberse6\ .sysnotifications 6"sysobjectsr6#,@&sysoperatorse6 *syspermissions&6$sysprotects6(sysreferences6:s$syssegments6RDDsystargetservergroupmembers6x.P8systargetservergroups6g.systargetserversE6? \8systargetservers_view6"systaskidsR6B"<<D>:2(>840:DH@$DJfH@0BBDB.6$240,6@$<@<((D84B:@4F0BHHFHB28<&$>02(80TD(2(2@2>804,( *(("$*",( *4"&(&,($"."&*$($D8.8"(0.0.65I0CHECK_CONSTRAINTS6u\{4COLUMN_DOMAIN_USAGE6|0COLUMN_PRIVILEGES6<8zCOLUMNS6=~1<CONSTRAINT_COLUMN_USAGE6Z=:CONSTRAINT_TABLE_USAGEi6Z36default_current_dateA@{ $default_one6!@default_sdl_error_message6W&default_zeroR6 l~2DOMAIN_CONSTRAINTSo6x}DOMAINS6Y`.KEY_COLUMN_USAGEl6U<REFERENTIAL_CONSTRAINTS6XvSCHEMATAA6 5,sp_add_category6`MS"sp_add_job 6M2sp_add_jobschedule 6}:@.sp_@dd_jobserverV6EG*sp_add_jobstept6{/>sp_add_targetservergroupd6_2Bsp_add_targetsvrgrp_memberE6l"sp_addtaska6G:Y<sp_apply_job_to_targets67_<sp_check_for_owned_jobs6\`Dsp_check_for_owned_jobsteps6[>sp_convert_jobid_to_charC6c(:sp_@elete_all_msx_jobs 6|F72sp_delete_categoryN6c5U(sp_delete_job6n'>sp_delete_job_references 6FpP8sp_delete_jobschedule6.A4sp_delete_jobserver6I0sp_delete_jobstep69:sp_delete_targetserver+6H0Dsp_delete_targetservergroup63Hsp_delete@targetsvrgrp_member6A%@sp_downloaded_row_limiter6-Wn$sp_droptask6a DDsp_enum_sqlagent_subsystems6^KK*Jsp_generate_server_descriptionE6%'W)fsp_generate_target_server_job_assignment_sqlz6^Hsp_get_chunked_jobstep_params6)V@sp_get_composite_jo@_info6Z0sp_get_job_alerts6eEBsp_get_jobstep_db_username 6Bsp_get_message_description 6)?KDsp_get_schedule_description6 '-Bsp_get_sqlagent_propertiesm6j8.sp_help_category96(C6sp_help_downloadlistc6W$sp_help_job6DhF?2sp_help_jobhi@torym6eQ4sp_help_jobschedule6"B0sp_help_jobserver6J,sp_help_jobstep6':6sp_help_targetserverT6&m1@sp_help_targetservergroup6f{n$sp_helptask6)"<sp_is_sqlagent_starting6b@sp_jobhistory_row_limiter6X<sp_manage_jobs_by_login6Г3,(s@_msx_defect6o?+(sp_msx_enlist6YTgDsp_multi_server_job_summary6zz&8sp_post_msx_operation6i<4sp_purge_jobhistory6^YBsp_remove_job_from_targets6`u;:sp_resync_targetserver6@P2sp_sem_add_messageh6yt4sp_sem_drop_message6$ Fsp_sem_get_pe@f_counter_help6e5`f0sp_set_local_time6B.Bsp_set_sqlagent_propertiesp6wdHsp_sqlagent_check_msx_version6Hsp_sqlagent_get_perf_counters6 Fsp_sqlagent_get_startup_info6,Hsp_sqlagent_has_server_access6ȃcBsp_sqlagent_log_jobhistory6]!@2sp_sqlagent_notify6,le8sp_sqlagent_probe_msx6Ha<sp_sqlagent_refresh_job6+\&sp_start_job6d]$sp_stop_job6}Hh>sp_target_server_summary6$k0sp_uniquetaskname6C"62sp_update_categoryi6*AT(sp_update_job6 |O8sp_update_jobschedule6~H0s@_update_jobstep6ԫNTsp_update_replication_job_parameter6$0Dsp_update_targetservergroup62 m(sp_updatetask642sp_verify_category62sp_verify_job_time6r$>sp_veri@y_jobproc_caller 6bcL8sp_verify_jobschedule6 F0sp_verify_jobstep6AD4sp_verify_subsystem6o,sp_verifytaskid6 (sqlagent_info6v8 sysalerts6b*sysallocations6u(sysalternates6s(syscategories6"syscolumnst6$syscomments6^t@*sysconstraintsr6 "sysdependsc6> ,sysdownloadlist6`(sysfilegroups6_sysfilesr6 sysfiles16*sysforeignkeys64sysfulltextcatalogs6"sysindexes@6&sysindexkeys 6w (sysjobhistory6 sysjobs60&sysjobs_view@6@sysjobschedules6"U(sysjobservers6[y$sysjobsteps6"sysmembers6\ .sysnotificationse6"sysobjects6#,&sysoperatorss6 *syspermissionsg6$sysprotects6(sysreferences6:s$syssegments6RDDsystargetservergroupmembers6x.P8sys@argetservergroups6g.systargetservers6? \8systargetservers_view6"systaskids8602(80TD(2(2@2>804,( *(("$*",( *4"&(&,($"."&*$($D8.8"(0.0.F6B.Bsp_set_sqlagent_properties|6wdHsp_sqlagent_check_msx_version6Hsp_sqlagent_get_perf_counters6 Fsp_sqlagent_get_startup_inf@6,Hsp_sqlagent_has_server_access6ȃcBsp_sqlagent_log_jobhistory6]!2sp_sqlagent_notifyL6,le8sp_sqlagent_probe_msx6Ha<sp_sqlagent_refresh_job6+\&sp_start_job6d]$sp_stop_job6}Hh>sp_target_server_summary 6$k0sp_uniquetaskname6C"6@sp_update_category6*AT(sp_update_job6 |O8sp_update_jobschedule6~H0sp_update_jobstep6ԫNTsp_update_replication_job_parameter6$0Dsp_update_targetservergroup62 m(sp_updatetask642sp_verify_category 62sp_verify_job_timev6r$>sp_verify_jobproc_caller'6bcL8sp_verify_jobschedule6 F0sp_verify_jobstep6AD4sp_verify_subsystem6o,sp_verifytaskid6 (sqlagent_info6v8 sysalerts6b*sysallocations 6u@(sysalternates6s(syscategories6"syscolumns(6$syscomments6^t*sysconstraintsr6 "sysdependsN6> ,sysdownloadlist6`(sysfilegroups6_sysfilesc6 sysfiles16*sysforeignkeys 64sysfulltextcatalogs6"sysindexesn6@&sysindexkeysn6w (sysjobhistory6 sysjobs60&sysjobs_view 6,sysjobschedules6"U(sysjobservers6[y$sysjobsteps6"sysmembers_6\ .sysnotifications 6"sysobjectsr6#,&sysoperators*6 *syspermissions 6$sysprotects6@sysreferences6:s$syssegments6RDDsystargetservergroupmembers6x.P8systargetservergroups6g.systargetserverst6? \8systargetservers_view6"systaskids 6 1) BEGIN RAISERROR(14244, -1, -1) RETURN(1) -- Failure END -- Check that we have either task or old login name (or both, though it's redundant) IF ((@taskname IS NULL) AND (@oldloginname IS NULL)) BEGIN RAISERROR(14249, -1, -1) RETURN(1) -- Failure END -- Case [1]: Reassign a specific task [job]... IF (@taskname IS NOT NULL) BEGIN -- Check new login id IF (SUSER_ID(@newloginname) IS NULL) BEG@N RAISERROR(14262, -1, -1, '@newloginname', @newloginname) RETURN(1) -- Failure END -- NOTE: Normally we'd invoke sp_update_job by supplying the job_id, but since this is -- a legacy procedure we cannot change the parameter list to have the job_id -- supplied to us. Hence we use name and we run the risk of a [handled] error -- if the task [job] name is not unique. EXECUTE @retval = sp_update_job @job_name = @taskname, @owner_login_name = @new@oginname RETURN(@retval) -- 0 means success END -- Case [2]: Reassign all jobs belonging to the specified old login name... IF (@oldloginname IS NOT NULL) BEGIN EXECUTE @retval = sp_manage_jobs_by_login @action = 'REASSIGN', @current_owner_login_name = @oldloginname, @new_owner_login_name = @newloginname RETURN(@retval) -- 0 means success END END ) P  HP  P  P  4N34ŃC0 0d|,6}Hh,@target_serverP*` }Hh>  lI 6(a2oPF;<D cN(AqJ rP|44sp_helphistory|NA0&qA@taskname}Hh\[N"6q"@tasknamex=0&q88 =@taskidX@[6q@taskidx?0&q88 ?@eventidX[ 6q @eventid|C0&q88 C@messageid\ \$6q$@messageid|@  A0&q88 A@severity \ ] "6q"@severity),x   =0&q=@source X ^ 6q@sourceHE|! A0&q@A@category(SE\["6q"@category |"C0&q88 C@startdatet\`$6q$@startdatex#?0&q88  ?@enddateX\@ 6q  @enddate|$C0&q88  C@starttime\b$6q $@starttimex%?0&q88  ?@endtimecX] 6q  @endtime&@W0&q88  W@minimumtimesskippedp`86q 8@minimumtimesskipped'U0&q88  U@minimumrundurationLL)p`66q 6@minimumrunduration (@K0&q88 K@runstatusmaskdb,6q,@runstatusmask)M0&q88 M@minimumretriesR (h`.6q.@minimumretries  *G0&q88 @G@oldestfirst`!c (6q(@oldestfirstt"+!90&q 9@modeT#c"6q@modeP$| Nq0P%| %q0P&@~ &qP'~ 'qstP( (qDhF?" )q4*/N!N0*qP |44 Nsp_helphistorypd+:*6q*sp_helphistoryD,@ qH/|44SplitNextD. N2/@L/_L0_(L1_)I8200pCREATE PROCEDURE sp_rea@signtask @taskname sysname = NULL, -- Was VARCHAR(100) in 6.x @newloginname sysname, -- Was VARCHAR(30) in 6.x @oldloginname sysname = NULL -- Was VARCHAR(30) in 6.x AS BEGIN DECLARE @retval INT SET NOCOUNT ON IF (ISNULL(IS_SRVROLEMEMBER(N'sysadmin'), 0) <> 1) BEGIN RAISERROR(14244, -1, -1) RETURN(1) -- Failure END -- Check that we have either task or old login name (or both, though it's redundant) IF ((@taskname IS NULL) AND (@oldloginname IS NUL@)) BEGIN RAISERROR(14249, -1, -1) RETURN(1) -- Failure END -- Case [1]: Reassign a specific task [job]... IF (@taskname IS NOT NULL) BEGIN -- Check new login id IF (SUSER_ID(@newloginname) IS NULL) BEGIN RAISERROR(14262, -1, -1, '@newloginname', @newloginname) RETURN(1) -- Failure END -- NOTE: Normally we'd invoke sp_update_job by supplying the job_id, but since this is -- a legacy procedure we cannot change the parameter list t@ have the job_id -- supplied to us. Hence we use name and we run the risk of a [handled] error -- if the task [job] name is not unique. EXECUTE @retval = sp_update_job @job_name = @taskname, @owner_login_name = @newloginname RETURN(@retval) -- 0 means success END -- Case [2]: Reassign all jobs belonging to the specified old login name... IF (@oldloginname IS NOT NULL) BEGIN EXECUTE @retval = sp_manage_jobs_by_login @action = 'REASSIGN', @ @current_owner_login_name = @oldloginname, @new_owner_login_name = @newloginname RETURN(@retval) -- 0 means success END END &<3 1x8L40K)Jp<P5   4.|44.0-@30qCREATE PROCEDURE sp_helphistory @taskname sysname = NULL, -- Was VARCHAR(100) in 6.x @taskid INT = NULL, @eventid INT = NULL, @messageid INT = NULL, @severity INT = NULL, @source VARCHAR(30) = NULL, -- Obsolete in 7.0 @category VARCHAR(30) = NULL, -- Obsolete in 7.0 @startdate INT = NULL, -- YYYYMMD@ format @enddate INT = NULL, -- YYYYMMDD format @starttime INT = NULL, -- HHMMSS format @endtime INT = NULL, -- HHMMSS format @minimumtimesskipped INT = NULL, @minimumrunduration INT = NULL, -- HHMMSS format @runstatusmask INT = NULL, -- SQLOLE_COMPLETION_STATUS @minimumretries INT = NULL, @oldestfirst INT = NULL, @mode VARCHAR(10) = 'QUIC@' -- Or FULL AS BEGIN DECLARE @job_id UNIQUEIDENTIFIER DECLARE @order_by INT SET NOCOUNT ON -- If the name is supplied, get the job_id directly from sysjobs IF (@taskname IS NOT NULL) BEGIN SELECT @job_id = job_id FROM msdb.dbo.sysjobs_view WHERE (name = @taskname) -- Check if the name is ambiguous IF (@@rowcount > 1) BEGIN RAISERROR(14292, -1, -1, @taskname, '@taskid', '@taskname') RETURN(1) -- Failure END IF (@job_id IS N@LL) BEGIN RAISERROR(14262, -1, -1, '@taskname', @taskname) RETURN(1) -- Failure END END -- If the id is supplied lookup the corresponding job_id from systaskids IF (@taskid IS NOT NULL) BEGIN SELECT @job_id = job_id FROM msdb.dbo.systaskids WHERE (task_id = @taskid) -- Check that the job still exists IF (NOT EXISTS (SELECT * FROM msdb.dbo.sysjobs_view WHERE (job_id = @job_id))) BEGIN SELEC@ @taskname = CONVERT(NVARCHAR, @taskid) RAISERROR(14262, -1, -1, '@taskid', @taskname) RETURN(1) -- Failure END END SELECT @mode = UPPER(@mode) IF (@mode = 'QUICK') SELECT @mode = 'SUMMARY' CREATE TABLE #task_history_full ( instance_id INT NOT NULL, job_id UNIQUEIDENTIFIER NOT NULL, job_name sysname NOT NULL, step_id INT NOT NULL, step_name sysname NOT NULL, s@l_message_id INT NOT NULL, sql_severity INT NOT NULL, message NVARCHAR(1024) NULL, run_status INT NOT NULL, run_date INT NOT NULL, run_time INT NOT NULL, run_duration INT NOT NULL, operator_emailed sysname NULL, operator_netsent sysname NULL, operator_paged sysname NULL, retries_attempted INT NOT NULL, s@rver NVARCHAR(30) NOT NULL ) CREATE TABLE #task_history_quick ( job_id UNIQUEIDENTIFIER NOT NULL, job_name sysname NOT NULL, run_status INT NOT NULL, run_date INT NOT NULL, run_time INT NOT NULL, run_duration INT NOT NULL, operator_emailed sysname NULL, operator_netsent sysname NULL, operator_paged sysname NULL, @ retries_attempted INT NOT NULL, server NVARCHAR(30) NOT NULL ) IF (@mode = 'FULL') BEGIN INSERT INTO #task_history_full EXECUTE msdb.dbo.sp_help_jobhistory @job_id = @job_id, @sql_message_id = @messageid, @sql_severity = @severity, @start_run_date sH/|44@SplitNextD9 //We@maL:0_L;8_vL<_2L=0L5qP>  649|44@90 8;_ 0q_ = @startdate, @end_run_date = @enddate, @start_run_time = @starttime, @end_run_time = @endtime, @minimum_run_duration = @minimumrunduration, @run_status = @runstatusmask, @ @minimum_retries = @minimumretries, @oldest_first = @oldestfirst, @mode = @mode END ELSE BEGIN INSERT INTO #task_history_quick EXECUTE msdb.dbo.sp_help_jobhistory @job_id = @job_id, @sql_message_id = @messageid, @sql_severity = @@everity, @start_run_date = @startdate, @end_run_date = @enddate, @start_run_time = @starttime, @end_run_time = @endtime, @minimum_run_duration = @minimumrunduration, @run_status = @runstatusmask, @ @minimum_retries = @minimumretries, @oldest_first = @oldestfirst, @mode = @mode END IF (@mode = 'FULL') BEGIN SELECT id = sti.task_id, eventid = 0, messageid = sql_message_id, severity = sql_severity, taskname = job_name, source = '', @ category = '', runstatus = run_status, rundate = run_date, runtime = run_time, runduration = run_duration, reviewstatus = 0, emailoperatorname = operator_emailed, retries = retries_attempted, comments = message, timesskipped = 0 FROM #task_history_full thf, systaskids sti WHERE (thf.job_id = sti.job_@d) END ELSE BEGIN SELECT taskname = job_name, source = '', runstatus = run_status, rundate = run_date, runtime = run_time, runduration = run_duration, emailoperatorname = operator_emailed, retries = retries_attempted FROM #task_history_quick END END PA  ?PHB BPC C PD D4|44 ::H:99.--@-,,\,,+\Pt,<L$ < P \ \ t $T| Lx$T(\ 1) BEGIN RAISERROR(14292, -1, -1, @taskname, '@taskid', '@taskname') RETURN(1) -- Failure END IF (@job_id IS NULL) BEGIN RAISERROR(14262, -1, -1,@'@taskname', @taskname) RETURN(1) -- Failure END END -- If the id is supplied lookup the corresponding job_id from systaskids IF (@taskid IS NOT NULL) BEGIN SELECT @job_id = job_id FROM msdb.dbo.systaskids WHERE (task_id = @taskid) -- Check that the job still exists IF (NOT EXISTS (SELECT * FROM msdb.dbo.sysjobs_view WHERE (job_id = @job_id))) BEGIN SELECT @taskname = CONVERT(NVARCHAR, @taskid) @RAISERROR(14262, -1, -1, '@taskid', @taskname) RETURN(1) -- Failure END END EXECUTE sp_purge_jobhistory @job_id = @job_id END jscP  EP P  P 4X54H́C0 8 8HX,\ 'activeenddate' = ISNULL(sjsch.active_end_date, 99991231), 'activestarttimeofday' = ISNULL(sjsch.active_start_time, 0), 'activeendtimeofday' = ISNULL(sjsch.active_end_time, 235959), 'lastrundate' = sjs.last_run_date, 'lastruntime' = sjs.last_run_time, 'nextrundate' = ISNULL(sjsch.next_run_date, 0), 'nextruntime' = ISNULL(sjsch.ne EJP D c(A0sTtd9640trig_targetserver_insertP  0sgateP 0sg _moL&   g gD&@0P` g 0s 1 b0*0sTRg964 btrig_targetserver_insert x I>60s>trig_targetserver_insertttD ! g0s l00slCREATE TRIG@ER trig_targetserver_insert ON msdb.dbo.systargetservers FOR INSERT, DELETE AS BEGIN SET NOCOUNT ON -- Disallow the insert if the server is called 'ALL' -- NOTE: We have to do this check here in the trigger since there is no sp_add_targetserver -- (target servers insert a row for themselves when they 'enlist' in an MSX) IF (EXISTS (SELECT * FROM inserted WHERE (server_name = N'ALL'))) BEGIN DELETE FROM msdb.dbo.systargetservers WHERE (se@ver_name = N'ALL') RAISERROR(14271, -1, -1, 'ALL') RETURN END -- Set (or delete) the registy flag (so that SETUP can detect if we're an MSX) IF ((SELECT COUNT(*) FROM msdb.dbo.systargetservers) = 0) BEGIN DECLARE @val INT EXECUTE master.dbo.xp_regread N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\SQLServerAgent', N'MSXServer', @val OUTPUT, @ N'no_output' IF (@val IS NOT NULL) EXECUTE master.dbo.xp_regdeletevalue N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\SQLServerAgent', N'MSXServer' END ELSE EXECUTE master.dbo.xp_regwrite N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\SQLServerAgent', N'MSXServer', H N'REG_DWORD', 1 END P  P P  4964< L dP0`\BEGIN IF (@job_aspect = 'ALL') BEGIN PRINT '' 2D_lt= [ Qa26 rGXz `F64,4systasks_viewNDlVC2Q30&I0j88 3id LV2R6I0jidpVDV70&I0j7name@PVVX64L\E0\VV"6I0j"subsystemp_tVFV;0&I0j;server TV V6I0jserverxV GV ?0&P nD c(ATtxut74>sp_verify_performance_condition&1[0&Tt[@performance_conditiontUy <6Tt<@performance_condition Tt@Vp0*TtP 74 psp_verify_performance_condition L6TtLsp_verify_performance_conditionD!  Tt _= 0Tt CREATE PROCEDURE sp_verify_performance_condition @performance_condition @VARCHAR(512) AS BEGIN DECLARE @delimiter_count INT DECLARE @temp_str NVARCHAR(512) DECLARE @object_name sysname DECLARE @counter_name sysname DECLARE @instance_name sysname DECLARE @pos INT SET NOCOUNT ON -- The performance condition must have the format 'object|counter|instance|comparator|value' -- NOTE: 'instance' may be empty. IF (PATINDEX(N'%_|%_|%|[><=]|[0-9]%', @performance_condition) = 0) BEGIN RAISERROR(14507, 16, 1) RET@RN(1) -- Failure END -- Parse the performance_condition SELECT @delimiter_count = 0 SELECT @temp_str = @performance_condition SELECT @pos = CHARINDEX(N'|', @temp_str) WHILE (@pos <> 0) BEGIN SELECT @delimiter_count = @delimiter_count + 1 IF (@delimiter_count = 1) SELECT @object_name = SUBSTRING(@temp_str, 1, @pos - 1) IF (@delimiter_count = 2) SELECT @counter_name = SUBSTRING(@temp_str, 1, @pos - 1) IF (@delimiter_count = 3) SELECT @instance_name = SUBSTRING(@temp@str, 1, @pos - 1) SELECT @temp_str = SUBSTRING(@temp_str, @pos + 1, (DATALENGTH(@temp_str) / 2) - @pos) SELECT @pos = CHARINDEX(N'|', @temp_str) END IF (@delimiter_count <> 4) BEGIN RAISERROR(14507, 16, 1) RETURN(1) -- Failure END -- Check the object_name IF (NOT EXISTS (SELECT * FROM master.dbo.sysperfinfo WHERE (object_name = @object_name))) BEGIN RAISERROR(14262, 16, 1, 'object_name', @object_name) RETURN(1) -- Fa@lure END -- Check the counter_name IF (NOT EXISTS (SELECT * FROM master.dbo.sysperfinfo WHERE (object_name = @object_name) AND (counter_name = @counter_name))) BEGIN RAISERROR(14262, 16, 1, 'counter_name', @counter_name) RETURN(1) -- Failure END -- Check the instance_name IF (@instance_name IS NOT NULL) BEGIN IF (NOT EXISTS (SELECT * FROM master.dbo.sysperfinfo WHE@E (object_name = @object_name) AND (counter_name = @counter_name) AND (instance_name = @instance_name))) BEGIN RAISERROR(14262, 16, 1, 'instance_name', @instance_name) RETURN(1) -- Failure END END RETURN(0) -- Success END P  P  P  H474x8x8  0 h$d\&I0j88 =enabledAN0&I0j88 ?freqtype 0&I0j88 Gfreqintervala0&I0j88 Efreqsubtype9p0&I0j88 Mfreqsubinterval, 0&:s88 Ri_UNPF\IJD c(Axu.vT84sp_verify_alertct990&xu9@name9cTU 6xu@name8:E0&xu88 E@message_id `@U &6xu&@message_idi|;A0&xu88 A@severityAL\U "6xu"@severity&x<?0&xu00?@enabledFX U  6xu @enabled@ = _0&xu88 _@delay_between_responsesRx U  @6xu@@delay_between_responses > Y0&xuY@notification_messaget U  :6xu:@notificat@on_messageO? i0&xu00i@include_event_description_inMEU J6xuJ@include_event_description_inB@K0&xuK@database_namedU ,6x@,@database_nameAc0&xu  c@event_description_keyword|U D6xu D@event_description_keywordxB=0&xu$$  =@job_idXU6xu @job_ide|CA0&xu  A@job_nameu\U"6xu "@job_name8DQ0&xu88  Q@occurrence_count.lU26xu 2@occurrence_countE@O0&xu00  O@raise_snmp_traphU06xu 0@raise_snmp_trapF[0&xu[@performance_conditiontU<6xu<@performance_conditionG@K0&xuK@category_namedU ,6xu,@category_name HG0&xu88 G@category_id`!U  (6xu(@category_id"I!Q0&xu88 @Q@count_reset_datetl#U "26xu2@count_reset_date$J#Q0&xu88 Q@count_reset_timel%U $26xu2@count_reset_timeeP& xuv8eP'@'xuM#&P( (xu"UP) )xu"UtP* *xuTtP+ +xusP, ,xusiP- -xu@sP. .xusP/ /xu^=|P0 0xu DR> 1xu2P0*xuP 84 Psp_verify_alertd3,6xu,sp_verify@alertD4! xu5_ 0xuCREATE PROCEDURE sp_verify_alert @name sysname, @message_id INT, @severity INT, @enabled TINYINT, @delay_between_responses INT, @notification_message NVARCHAR(512), @include_event_description_in TINYINT, @database_name @ sysname, @event_description_keyword NVARCHAR(100), @job_id UNIQUEIDENTIFIER OUTPUT, @job_name sysname OUTPUT, @occurrence_count INT, @raise_snmp_trap TINYINT, @performance_condition NVARCHAR(512), @category_name sysname, @category_id INT OUTPUT, @count_reset_date INT, @count_reset_time INT AS BEGIN DECLA@E @retval INT DECLARE @non_alertable_errors VARCHAR(512) DECLARE @message_id_as_string VARCHAR(10) DECLARE @res_valid_range NVARCHAR(100) SET NOCOUNT ON -- Remove any leading/trailing spaces from parameters SELECT @name = LTRIM(RTRIM(@name)) SELECT @notification_message = LTRIM(RTRIM(@notification_message)) SELECT @database_name = LTRIM(RTRIM(@database_name)) SELECT @event_description_keyword = LTRIM(RTRIM(@event_descri@tion_keyword)) SELECT @job_name = LTRIM(RTRIM(@job_name)) SELECT @performance_condition = LTRIM(RTRIM(@performance_condition)) SELECT @category_name = LTRIM(RTRIM(@category_name)) -- Only a sysadmin can do this IF (ISNULL(IS_SRVROLEMEMBER(N'sysadmin'), 0) <> 1) BEGIN RAISERROR(15003, 16, 1, N'sysadmin') RETURN(1) -- Failure END -- Check if the NewName is unique IF (EXISTS (SELECT * FROM msdb.dbo.sysalerts @ WHERE (name = @name))) BEGIN RAISERROR(14261, 16, 1, '@name', @name) RETURN(1) -- Failure END -- Check if the user has supplied MessageID OR Severity OR Performance-Condition IF ((@performance_condition IS NULL) AND ((@message_id = 0) AND (@severity = 0)) OR ((@message_id <> 0) AND (@severity <> 0))) OR ((@performance_condition IS NOT NULL) AND ((@message_id <> 0) OR (@severity <> 0))) BEGIN RAISERROR(14500, 16, 1) RETURN(1) -- Failure END -- Check th@ Severity IF ((@severity < 0) OR (@severity > 25)) BEGIN RAISERROR(14266, 16, 1, '@severity', '0..25') RETURN(1) -- Failure END -- Check the MessageID IF (@message_id <> 0) AND (NOT EXISTS (SELECT error FROM master.dbo.sysmessages WHERE (error = @message_id))) BEGIN SELECT @message_id_as_string = CONVERT(VARCHAR, @message_id) RAISERROR(14262, 16, 1, '@message_id', @message_id_as_string) RETURN(1) -- Failure END @ -- Check if it is legal to set an alert on this MessageID CREATE TABLE #TempRetVal (RetVal INT) EXECUTE master.dbo.xp_regread N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\SQLServerAgent', N'NonAlertableErrors', @non_alertable_errors OUTPUT, N'no_output' IF (ISNULL(@non_alertable_errors, N'NULL') <> N'NULL') BEGIN DECLARE @message_id_as_char VARCHA@(10) SELECT @message_id_as_char = CONVERT(VARCHAR(10), @message_id) INSERT INTO #TempRetVal EXECUTE ('IF (' + @message_id_as_char + ' IN (' + @non_alertable_errors + ')) SELECT 1') END IF (EXISTS (SELECT * FROM #TempRetVal)) BEGIN RAISERROR(14506, 16, 1, @message_id) RETURN(1) -- Failure END DROP TABLE #TempRetVal -- Enabled must be 0 or 1 IF (@enabled NOT IN (0, 1)) BEGIN RAISERROR(14266, 16, 1, '@enabled', '0, 1') RETURN(1)@-- Failure END -- DelayBetweenResponses must be > 0 oH/84SplitNextD7 :/I0@L8_ZL9_6ZunL:Z _v0;90xuCRE@TE PROCEDURE sp_verify_alert @name sysname, @message_id INT, @severity INT, @enabled TINYINT, @delay_between_responses INT, @notification_message NVARCHAR(512), @include_event_description_in TINYINT, @database_name sysname, @event_description_keyword NVARCHAR(100), @job_id UNIQUEIDENTIFIER OUTPUT, @job_name sy@name OUTPUT, @occurrence_count INT, @raise_snmp_trap TINYINT, @performance_condition NVARCHAR(512), @category_name sysname, @category_id INT OUTPUT, @count_reset_date INT, @count_reset_time INT AS BEGIN DECLARE @retval INT DECLARE @non_alertable_errors VARCHAR(512) DECLARE @message_id_as_string VARCHAR(10) DECLARE @res_valid_range NVARCHA@(100) SET NOCOUNT ON -- Remove any leading/trailing spaces from parameters SELECT @name = LTRIM(RTRIM(@name)) SELECT @notification_message = LTRIM(RTRIM(@notification_message)) SELECT @database_name = LTRIM(RTRIM(@database_name)) SELECT @event_description_keyword = LTRIM(RTRIM(@event_description_keyword)) SELECT @job_name = LTRIM(RTRIM(@job_name)) SELECT @performance_condition = LTRIM(RTRIM(@performance_condition)) SE@ECT @category_name = LTRIM(RTRIM(@category_name)) -- Only a sysadmin can do this IF (ISNULL(IS_SRVROLEMEMBER(N'sysadmin'), 0) <> 1) BEGIN RAISERROR(15003, 16, 1, N'sysadmin') RETURN(1) -- Failure END -- Check if the NewName is unique IF (EXISTS (SELECT * FROM msdb.dbo.sysalerts WHERE (name = @name))) BEGIN RAISERROR(14261, 16, 1, '@name', @name) RETURN(1) -- Failure END -- Check if the user has supplied MessageID@OR Severity OR Performance-Condition IF ((@performance_condition IS NULL) AND ((@message_id = 0) AND (@severity = 0)) OR ((@message_id <> 0) AND (@severity <> 0))) OR ((@performance_condition IS NOT NULL) AND ((@message_id <> 0) OR (@severity <> 0))) BEGIN RAISERROR(14500, 16, 1) RETURN(1) -- Failure END -- Check the Severity IF ((@severity < 0) OR (@severity > 25)) BEGIN RAISERROR(14266, 16, 1, '@severity', '0..25') RETURN(1) -- Failure END -- Chec@ the MessageID IF (@message_id <> 0) AND (NOT EXISTS (SELECT error FROM master.dbo.sysmessages WHERE (error = @message_id))) BEGIN SELECT @message_id_as_string = CONVERT(VARCHAR, @message_id) RAISERROR(14262, 16, 1, '@message_id', @message_id_as_string) RETURN(1) -- Failure END -- Check if it is legal to set an alert on this MessageID CREATE TABLE #TempRetVal (RetVal INT) EXECUTE master.dbo.xp_regread N'HKEY_LOCAL_MACHINE', @ N'SOFTWARE\Microsoft\MSSQLServer\SQLServerAgent', N'NonAlertableErrors', @non_alertable_errors OUTPUT, N'no_output' IF (ISNULL(@non_alertable_errors, N'NULL') <> N'NULL') BEGIN DECLARE @message_id_as_char VARCHAR(10) SELECT @message_id_as_char = CONVERT(VARCHAR(10), @message_id) INSERT INTO #TempRetVal EXECUTE ('IF (' + @message_id_as_char + ' IN (' + @non_alertable_errors + ')) SELECT 1') END IF (EXISTS (SELECT * FROM #TempRetVal)) BEGIN RAISERROR(14506, 16, 1, @message_id) RETURN(1) -- Failure END DROP TABLE #TempRetVal -- Enabled must be 0 or 1 IF (@enabled NOT IN (0, 1)) BEGIN RAISERROR(14266, 16, 1, '@enabled', '0, 1') RETURN(1) -- Failure END -- DelayBetweenResponses must be > 0 << _:x8L=0N@>xuP>   4784706<x0xux IF (@delay_between_responses < 0) BEGIN SELECT @res_valid_range = FORMATMESSAGE(14206) RAISERROR(14266, 16, 1, '@delay_between_responses', @res_valid_range) RETURN(1) -- Failure END -- NOTE: We don't check the notification message @ -- Check IncludeEventDescriptionIn IF ((@include_event_description_in < 0) OR (@include_event_description_in > 7)) BEGIN SELECT @res_valid_range = FORMATMESSAGE(14208) RAISERROR(14266, 16, 1, '@include_event_description_in', @res_valid_range) RETURN(1) -- Failure END -- Check the database name IF (@database_name IS NOT NULL) AND (DB_ID(@database_name) IS NULL) BEGIN RAISERROR(15010, 16, 1, @database_name) RETURN(1) -- Failure END -- NOTE: We don't check@the event description keyword -- Check JobName/ID IF ((@job_id IS NOT NULL) OR (@job_name IS NOT NULL)) BEGIN -- We use '' as a special value which means 'no job' (we cannot use NULL since this forces -- sp_update_alert to use the existing value) IF (@job_name = N'') SELECT @job_id = 0x00 ELSE BEGIN EXECUTE @retval = sp_verify_job_identifiers '@job_name', '@job_id', @ @job_name OUTPUT, @job_id OUTPUT IF (@retval <> 0) RETURN(1) -- Failure -- Check that the job is a local job IF (NOT EXISTS (SELECT * FROM msdb.dbo.sysjobservers WHERE (job_id = @job_id) AND (server_id = 0))) BEGIN RAISERROR(14234, -1, -1, '@job_id', 'sp_help_job @job_type = ''LOCAL''') RETURN(1) -- Failure END @ END END -- OccurrenceCount must be > 0 IF (@occurrence_count < 0) BEGIN RAISERROR(14266, 16, 1, '@occurrence_count', '0..n') RETURN(1) -- Failure END -- RaiseSNMPTrap must be 0 or 1 IF (@raise_snmp_trap NOT IN (0, 1)) BEGIN RAISERROR(14266, 16, 1, '@raise_snmp_trap', '0, 1') RETURN(1) -- Failure END -- Check the performance condition (including invalid parameter combinations) IF (@performance_condition IS NOT NULL) BEGIN IF (@database_na@e IS NOT NULL) BEGIN RAISERROR(14505, 16, 1, 'database_name') RETURN(1) -- Failure END IF (@event_description_keyword IS NOT NULL) BEGIN RAISERROR(14505, 16, 1, 'event_description_keyword') RETURN(1) -- Failure END -- Verify the performance condition EXECUTE @retval = msdb.dbo.sp_verify_performance_condition @performance_condition IF (@retval <> 0) RETURN(1) -- Failure END -- Check category name IF (@category_name = N@[DEFAULT]') SELECT @category_id = 98 ELSE BEGIN SELECT @category_id = category_id FROM msdb.dbo.syscategories WHERE (category_class = 2) -- Alerts AND (category_type = 3) -- None AND (name = @category_name) END IF (@category_id IS NULL) BEGIN RAISERROR(14262, -1, -1, '@category_name', @category_name) RETURN(1) -- Failure END -- Check count reset date IF (@count_reset_date <> 0) BEGIN EXECUTE @retval = msdb.dbo.sp_verify_job_date @count_reset_date, '@count_reset_date' IF (@retval <> 0) RETURN(1) -- Failure END -- Check count reset time IF (@count_reset_time <> 0) BEGIN EXECUTE @retval = msdb.dbo.sp_verify_job_time @count_reset_time, '@count_reset_time' IF (@retval <> 0) RETURN(1) -- Failure END RETURN(0) -- Success END PA  ?PB BPHC C PD D484eteHLHGG\G8x8(877'd''&&@&P  `p 0$,@\ d h t  @ (@0Xx$\^t T u tou TOu  ˿w D˿w@'m @ k LRsA R e pR _ @uiP)Z!"JD c(A.vgwL94sp_add_alerttM%90&.v9@nameTU&6.v@nameyNE0&.v88 E@message_id`@U&6.v&@message_id|OA0&.v88 A@severity\U"6.v"@severityxP?0&.v00?@enabledX U 6.v @enabled@ Q _0&.v88 _@delay_between_responsesx U @6.v@@delay_between_responses R Y0&.vY@notification_messaget U! :6.v:@notification_@essage S i0&.v00i@include_event_description_inUJ6.vJ@include_event_description_in(TK0&.vK@database_namedU,6.v@,@database_nameUc0&.v  c@event_description_keyword|U D6.v D@event_description_keywordxV=0&.v$$  =@job_id`XU"6.v @job@id|WA0&.v  A@job_name\U#"6.v "@job_nameXO0&.v00  O@raise_snmp_trapNhU'06.v 0@raise_snmp_trapY@[0&.v  [@performance_conditiontU'<6.v <@performance_conditionH/94SplitNextD 8/@L&SLSL@ SN E|!4;=99EA?_YiKc=AQO[KGQQ7=9EA?_YiKc=AO[GEGigcIGCCSQMIGCC0&^t88 ;statusU0&^t88 =actionsLK0&^t88 9error? ?0&xu9@name$4$0&xu88 @E@message_idT0&xu88 A@severity0&xu00?@enabled0&xu88 _@delay_between_responses0&xuY@notification_message0&xu00i@include_event_description_in0&xuK@@database_nameA0&xu  c@event_description_keyword0&xu$$  =@job_idl0&xu  A@job_name0&xu88  Q@occurrence_countD0&xu00  O@raise_snmp_trap0&xu[@performance_conditio@n0&xuK@category_name0&xu88 G@category_id0&xu88 Q@count_reset_date0&xu88 Q@count_reset_time0&u447suid@0&u44=altsuid0&.v9@name0&.v88@ E@message_id0&.v88 A@severity0&.v00?@enabled0&.v88 _@delay_between_responsesj0&.vY@notification_message 0&.v00i@include_event_description_in 0&.v@K@database_namec0&.v  c@event_description_keyword 0&.v$$  =@job_iddul0&.v  A@job_nameme'0&.v00  O@raise_snmp_trape0&.v  [@performance_condition,0&XvGCATAL@OG_NAMEe0&XvESCHEMA_NAMEfre0&XvGSCHEMA_OWNERa0&XviDEFAULT_CHARACTER_SET_CATALOGeq_0&XvgDEFAULT_CHARACTER_SET_SCHEMAe0&XvcDEFAULT_CHARACTER_SET_NAMEt0&˿w@ITABLE_CATALOG WH0&˿wGTABLE_SCHEMAe0&˿wCTABLE_NAME 0&˿w CTABLE_TYPEO0&xSCONSTRAINT_CATALOG 0&xQCONSTRAINT_SCHEMAIN 0&xMCONSTRAINT_NAMEail0&x@ITABLE_CATALOGmet0&xGTABLE_SCHEMAL0&xCTABLE_NAME <" 6 4Dx8L#N ^t\'P$ E49404$"HK0&.vK@category_named'U,6.v,@category_nameP( 1.v)"OtO T LH d d h  8  8(Pp\ ?>>,>=h..--4-,,,HLHGG\G8x8(877'd''&&@&P  `p  T LH d d h  8  8(_mPBDF"P) ).vsCRP .vs'iP .vxu P .vv8.nP .vv8 P .vv8 P@ .vv8'uP .vv8_uP .vv8 T   Defa.vv8P   .vv8seP   .vv8 P  @ .vv8.eT     .vv8T  -- .vv8P .vv8 IP .vv8  P .vv8 chP @vv8 suP .vv8 suP .vv8 tiP .vv8tiP .vv8enT q_re.vv8T star.vv8P@ .vv8, P .vv8 P .vv899P .vv8ayP .vv80)P .vv8 IT @3595.vv8P   .vv8asP! !.vv8 P" ".v]!'n #.v4$3J0*.vP 94 Jsp_add_alert `%&6.@v&sp_add_alert D&!5 .vH/94SplitNextD( /fy@_eL)ZQL*Z;Qp L+Q,Z s,@* 0˿w--Identifies tables accessible to the current user create view INFORMATION_SCHEMA.TABLES as select distinct db_name() as TABLE_CATALOG ,user_name(o.uid) as TABLE_SCHEMA ,o.name as TABLE_NAME ,case o.xtype when 'U' then 'BASE TABLE' when 'V' then 'VIEW' end as TABLE_TYPE from sysobjects o where o.xtype in ('U', 'V') and permissions(o.id) != 0 0x--Identifies table constraints owned by current users create view @NFORMATION_SCHEMA.TABLE_CONSTRAINTS as select db_name() as CONSTRAINT_CATALOG ,user_name(c_obj.uid) as CONSTRAINT_SCHEMA ,c_obj.name as CONSTRAINT_NAME ,db_name() as TABLE_CATALOG ,user_name(t_obj.uid) as TABLE_SCHEMA ,t_obj.name as TABLE_NAME ,case c_obj.xtype when 'C' then 'CHECK' when 'UQ' then 'UNIQUE' when 'PK' then 'PRIMARY KEY' when 'F' then 'FOREIGN KEY' end as CONSTRAINT_TYPE ,'NO' as IS_DEFERRABLE ,'NO' as INITIALLY_DEFERR@D from sysobjects c_obj ,sysobjects t_obj where c_obj.uid = user_id() and t_obj.id = c_obj.parent_obj and c_obj.xtype in ('C' ,'UQ' ,'PK' ,'F') 0y --Identifies privileges granted to or by the current user create view INFORMATION_SCHEMA.TABLE_PRIVILEGES as select user_name(p.grantor) as GRANTOR ,user_nam@e(p.uid) as GRANTEE ,db_name() as TABLE_CATALOG ,user_name(o.uid) as TABLE_SCHEMA ,o.name as TABLE_NAME ,case p.action when 26 then 'REFERENCES' when 193 then 'SELECT' when 195 then 'INSERT' when 196 then 'DELETE' when 19@7 then 'UPDATE' end as PRIVILEGE_TYPE ,case when p.protecttype = 205 then 'NO' else 'YES' end as IS_GRANTABLE from sysprotects p, sysobjects o where (is_member(user_name(p.uid)) = 1 or p.grantor = user_id()) and @(p.protecttype = 204 or /*grant exists without same grant with grant */ (p.protecttype = 205 and not exists(select * from sysprotects p2 where p2.id = p.id and p2.uid = p.uid and p2.action = p.action and p2.columns = p.columns a@nd p2.grantor = p.grantor and p2.protecttype = 204))) and p.action in (26,193,195,196,197) and p.id = o.id and o.xtype in ('U', 'V') and 0 != (permissions(o.id) & case p.action when 26 then 4 /*REFERENCES basebit on all colum@ns */ when 193 then 1 /*SELECT basebit on all columns */ when 195 then 8 /*INSERT basebit */ when 196 then 16 /*DELETE basebit */ when 197 then 2 /*UPDATE basebit on all columns */ end) <- Z+x8L@0P>˿wP/  %4(94(0'Z.0.vCREATE PROCEDURE sp_add_alert @name sysname, @message_id INT = 0, @severity INT = 0, @enabled TINYINT = 1, @@delay_between_responses INT = 0, @notification_message NVARCHAR(512) = NULL, @include_event_description_in TINYINT = 5, -- 0 = None, 1 = Email, 2 = Pager, 4 = NetSend, 7 = All @database_name sysname = NULL, @event_description_keyword NVARCHAR(100) = NULL, @job_id UNIQUEIDENTIFIER = NULL, -- If provided must NOT also provide job_name @job_name sysname = NULL, -- If pro@ided must NOT also provide job_id @raise_snmp_trap TINYINT = 0, @performance_condition NVARCHAR(512) = NULL, -- New for 7.0 @category_name sysname = NULL -- New for 7.0 AS BEGIN DECLARE @event_source NVARCHAR(100) DECLARE @event_category_id INT DECLARE @event_id INT DECLARE @last_occurrence_date INT DECLARE @last_occurrence_time INT DECLARE @last_notification_date INT DECLARE @last_noti@ication_time INT DECLARE @occurrence_count INT DECLARE @count_reset_date INT DECLARE @count_reset_time INT DECLARE @has_notification INT DECLARE @return_code INT DECLARE @duplicate_name sysname DECLARE @category_id INT DECLARE @alert_id INT SET NOCOUNT ON -- Remove any leading/trailing spaces from parameters SELECT @name = LTRIM(RTRIM(@name)) SELECT @notification_message = L@RIM(RTRIM(@notification_message)) SELECT @database_name = LTRIM(RTRIM(@database_name)) SELECT @event_description_keyword = LTRIM(RTRIM(@event_description_keyword)) SELECT @job_name = LTRIM(RTRIM(@job_name)) SELECT @performance_condition = LTRIM(RTRIM(@performance_condition)) SELECT @category_name = LTRIM(RTRIM(@category_name)) -- Turn [nullable] empty string parameters into NULLs IF (@notification_message = N'') SELECT @notification_m@ssage = NULL IF (@database_name = N'') SELECT @database_name = NULL IF (@event_description_keyword = N'') SELECT @event_description_keyword = NULL IF (@job_name = N'') SELECT @job_name = NULL IF (@performance_condition = N'') SELECT @performance_condition = NULL IF (@category_name = N'') SELECT @category_name = NULL SELECT @message_id = ISNULL(@message_id, 0) SELECT @severity = ISNULL(@severity, 0) -- Only a sysadmin can do this IF@(ISNULL(IS_SRVROLEMEMBER(N'sysadmin'), 0) <> 1) BEGIN RAISERROR(15003, 16, 1, N'sysadmin') RETURN(1) -- Failure END -- Check if SQLServerAgent is in the process of starting EXECUTE @return_code = msdb.dbo.sp_is_sqlagent_starting IF (@return_code <> 0) RETURN(1) -- Failure -- Hard-code the new Alert defaults SELECT @event_source = N'MSSQLServer' SELECT @event_category_id = NULL SELECT @event_id = NULL SELECT @last_occurrence_date = 0 SELECT @last_occurrenc@_time = 0 SELECT @last_notification_date = 0 SELECT @last_notification_time = 0 SELECT @occurrence_count = 0 SELECT @count_reset_date = 0 SELECT @count_reset_time = 0 SELECT @has_notification = 0 IF (@category_name IS NULL) BEGIN SELECT @category_name = name FROM msdb.dbo.syscategories WHERE (category_id = 98) END -- Map a job_id of 0 to the real value we use to mean 'no job' IF (@job_id = CONVERT(UNIQUEIDENTIFIER, 0x00)) AND (@job_name IS NULL) SELE@T @job_name = N'' -- Verify the Alert IF (@job_id = CONVERT(UNIQUEIDENTIFIER, 0x00)) SELECT @job_id = NULL EXECUTE @return_code = sp_verify_alert @name, IH/94SplitNextD3 )/@L40ZL5Z2ruL6@-Z( D75 0Xv  --Identifies schmata owned by current users, databases current users has permissions in create view INFORMATION_SCHEMA.SCHEMATA as select db.name as CATALOG_NAME ,USER_NAME() as SCHEMA_NAME ,USER_NAME() as SCHEMA_OWNER ,'master' as DEFAULT_CHARACTER_SET_CATALOG ,'dbo' as DEFAULT_CHARACTER_SET_SCHEMA ,a_cha.name as DEFAULT_CHARACTER_SET_NAME FROM master.dbo.sysdatabases @ db, master.dbo.sysconfigures cfg, master.dbo.syscharsets a_cha, --charset/1001, not sortorder. master.dbo.syscharsets b_cha --sortorder/2001, not charset. WHERE cfg.comment = 'default sortorder id' AND a_cha.type = 1001 --- type is charset AND b_cha.type = 2001 --- type is sortorder AND a_cha.id = b_cha.csid AND b_cha.id = cfg.value <8 Z6x8L90P/.vP: @ 0439430T280.v @message_id, @severity, @enabled, @delay_between_responses, @notification_message, @ @include_event_description_in, @database_name, @event_description_keyword, @job_id OUTPUT, @job_name OUTPUT, @occurrence_count, @raise_snmp_trap, @performance_condition, @ @category_name, @category_id OUTPUT, @count_reset_date, @count_reset_time IF (@return_code <> 0) RETURN(1) -- Failure -- Check if this Alert already exists SELECT @duplicate_name = FORMATMESSAGE(14205) SELECT @duplicate_name = name FROM msdb.dbo.sysalerts WHERE (ISNULL(performance_condition, N'apples') = ISNULL(@performance_condition, N'oranges')) OR@((performance_condition IS NULL) AND (message_id = @message_id) AND (severity = @severity) AND (ISNULL(database_name, N'') = ISNULL(@database_name, N'')) AND (ISNULL(event_description_keyword, N'') = ISNULL(@event_description_keyword, N''))) IF (@duplicate_name <> FORMATMESSAGE(14205)) BEGIN RAISERROR(14501, 16, 1, @duplicate_name) RETURN(1) -- Failure END -- Finally, do the actual INSERT INSERT INTO msdb.dbo.sysalerts (name, @ event_source, event_category_id, event_id, message_id, severity, enabled, delay_between_responses, last_occurrence_date, last_occurrence_time, last_response_date, last_response_time, notification_message, include_event_description, database_name, event_description_keyword, occurrence_count, count_reset_date, count_re@et_time, job_id, has_notification, flags, performance_condition, category_id) VALUES (@name, @event_source, @event_category_id, @event_id, @message_id, @severity, @enabled, @delay_between_responses, @last_occurrence_date, @last_occurrence_time, @last_notification_date, @last_notification_time, @notification_message, @ @include_event_description_in, @database_name, @event_description_keyword, @occurrence_count, @count_reset_date, @count_reset_time, ISNULL(@job_id, CONVERT(UNIQUEIDENTIFIER, 0x00)), @has_notification, @raise_snmp_trap, @performance_condition, @category_id) -- Notify SQLServerAgent of the change SELECT @alert_id = id FROM msdb.dbo.sysalerts WHERE (name = @name) EXECUTE msdb.d@o.sp_sqlagent_notify @op_type = N'A', @alert_id = @alert_id, @action_type = N'I' RETURN(0) -- Success END frP=  ;P> >P? ? %P@ @H494_vrDChCCBt4@433h3$0//@/..@ @ h $ @ 0 < LTdt$,<HXharttimeofday 0&l88 U@activeendtimeofday 0&l88 G@nextrundate 0&l88 G@nextruntimeC0&l88 b s Ce eTfv .EI.P}~F D c(Agw~xT:4sp_update_alert&t +'90&gw9@name?@T U1(6gw@namem| , A0&gwA@new_name\ @U2 "6gw"@new_nametx - ?0&gw00?@enabledX U1  6gw @enabled . E0&gw88 E@message_id=a`  U2 &6gw&@message_id@|  /  A0&gw88 A@severity\  U5  "6gw"@severity  0  _0&gw88 _@delay_between_responsesFx  U1  @6gw@@delay_between_responses @1  Y0&gwY@notification_message˿wt U6 :6gw:@notification_messageT 2 i0&gw00i@include_event_description_in& U3 J6gwJ@include_event_des@ription_inN 3 K0&gw  K@database_named U1 ,6gw ,@database_name 4 c0&gw  c@event_description_keyword8| U4 D6gw D@event_descrip@ion_keywordx 5 =0&gw$$  =@job_idX U6 6gw @job_idl| 6 A0&gw  A@job_namei\ U7 "6gw "@job_name 7 Q0&gw@8  Q@occurrence_countpl U< 26gw 2@occurrence_count 8 Q0&gw88 Q@count_reset_datell U1 26gw2@count_reset_date 9 Q0&gw88 @Q@count_reset_timel U2 26gw2@count_reset_timet  : Y0&gw88 Y@last_occurrence_datet !U:  :6gw:@last_occurrence_date "; !Y0&gw88 @Y@last_occurrence_timeE@t #U; ":6gw:@last_occurrence_timer $< #U0&gw88 U@last_response_datedep %U< $66gw6@last_response_dated &= %U0&gw88 @U@last_response_timep 'U= &66gw6@last_response_time (> 'O0&gw00O@raise_snmp_traph )UC (06gw0@raise_snmp_trap *? )[0&gw@[@performance_conditiont +UC *<6gw<@performance_condition ,@ +K0&gwK@category_named -U1 ,,6gw,@category_nameP . #gw)"P /@  /gwv8P 0  0gwv8P 1  1gwv8P 2  2gwv8P 3  3gwv8P 4  4gwv8P 5  5@gwv8P 6  6gwv8P 7  7gwv8P 8  8gwv8P 9  9gwv8P :  :gwv8P ;  ;gwv8 P@<  <gwv8  P =  =gwv8 PH/:4SplitNextD ?  4/`L @ < VXREOCL A 0L B  >QL@Wa C  B.vs, .vv8 .vv8 .vv8 .vv8 .vv8@ .vv8 @.vv8 I.vv8 @a.vv8  IN.vv8 @ac.vv8 INT.vv8 act.vv8 NT .vv8cti.vv8T .vv8xtr.vv8 .vv8tru.vv8 .vv8rio.vv8 .vv8ope.vv8e .vv8VAR.vv8etr.v]!T @v)"try.vxu gwv8mmagwv8 RCHgwv8 as gwv8  @gwv8l Igwv8 @egwv8 INgwv8@degwv8NVAgwv8- Wgwv8x gwv8 gwv8LL,gwv8 @gwv8 Igw)" --˿wtag˿wNT ˿w Ob˿w@id x x, x xLL,x  @y Iy @cy syy-- yoryy yforyCLAyLARyIFI<8z IN<8zsys<8z nv<8z NO<8z@re<8z@ucc<8z <8z na<8zon <8z ubs<8z S<8z15 <8zbsy<8z <8zd =<8z(@s<8zuti<8zego<8znve<8z nchu\{namu\{IF u\{N'su\{bsyu\{ u\{s pu\{s a@\{namu\{  IS| |e =|dbo|WHE|teg|cat| cat|SAG| --|dat| bu| av|faix}edux}e ax}ctix} (@x}001x}ivex}@  x} x} Ex}dd_x} x} e,  l~  l~,  l~  l~ @d l~  l~  l~   l~ , Y`venY`ompY`notY` Y` el,Y`_opY`perY`@_idY`= @Y`IF Y`EGIY` NSAY`t Y`  anY` forY`  byY` NSEY`askY`Y`Y`Y`Y`-- Y` idY`sk_Y` Y`skiY` = Y`d t<@ D   Cx8P E= V.vs_nP F A 4 ?:4 ?0P >  Dgwv8 de,P I  Igwv8 tabP J  Jgwv8 P@ K  Kgwv8un_P L  Lgwv8BACP M  Mgwv8F (P N  Ngw0nddP O  Ogws 0)P P  Pgws P Q6 @ Qgwxu taT R!  R@revalgwv8T S"  Same gwv8T T#  T @frgwv8T U$  Uervl, gwv8T V%  Val  = gwv8 T W*  W@  gwv8T X+  X  =gwv8T Y,  Y @ctigwv8T Z-  Z= @ctigwv8T [1  [SACIONgwv8T \.  \rve gwv8T ]/  ]@oca)' gwv8T ^0  ^uit gwv8T _&  _d =13)gwv8 T `'  `ublshegwv8 T a(  aderagegwv8 T b)  bher= @gwv8 T c2  c @ gwv8T d3  d  Igwv8T e4  et  gwv8T f!  f gwv8P g5  ggw]!tas  hgw4 i%P0*gwP :4 Psp_update_a@ertd j 4,6gw,sp_update_alertD k!' gwH/:4SplitNextD m  @/tva@ = L n0L o=@ptiL p@ exL q0Q:gwvaP r   G4 m:4 m0 l o0gwCREATE PROCEDURE sp_update_alert @name sysname, @new_name sysname = NULL, @enabled TINYINT = NULL, @@essage_id INT = NULL, @severity INT = NULL, @delay_between_responses INT = NULL, @notification_message NVARCHAR(512) = NULL, @include_event_description_in TINYINT = NULL, -- 0 = None, 1 = Email, 2 = Pager. 4 = NetSend, 7 = All @database_name sysname = NULL, @event_description_keyword NVARCHAR(100) = NULL, @job_id UNIQUEIDENTIFIER = NU@L, -- If provided must NOT also provide job_name @job_name sysname = NULL, -- If provided must NOT also provide job_id @occurrence_count INT = NULL, -- Can only be set to 0 @count_reset_date INT = NULL, @count_reset_time INT = NULL, @last_occurrence_date INT = NULL, -- Can only be set to 0 @last_occurrence_time INT = NULL, -- Can only be set t@ 0 @last_response_date INT = NULL, -- Can only be set to 0 @last_response_time INT = NULL, -- Can only be set to 0 @raise_snmp_trap TINYINT = NULL, @performance_condition NVARCHAR(512) = NULL, -- New for 7.0 @category_name sysname = NULL -- New for 7.0 AS BEGIN DECLARE @x_enabled TINYINT DECLARE @x_message_id INT DECLARE @x_severity @ INT DECLARE @x_delay_between_responses INT DECLARE @x_notification_message NVARCHAR(512) DECLARE @x_include_event_description TINYINT DECLARE @x_database_name sysname DECLARE @x_event_description_keyword NVARCHAR(100) DECLARE @x_occurrence_count INT DECLARE @x_count_reset_date INT DECLARE @x_count_reset_time INT DECLARE @x_last_occurrence_date INT DECLARE @x_last_occurrence_time INT DECLARE @x_last_response_date @ INT DECLARE @x_last_response_time INT DECLARE @x_flags INT DECLARE @x_performance_condition NVARCHAR(512) DECLARE @x_job_id UNIQUEIDENTIFIER DECLARE @x_category_id INT DECLARE @include_event_desc_code TINYINT DECLARE @return_code INT DECLARE @duplicate_name sysname DECLARE @category_id INT DECLARE @alert_id INT DECLARE @cached_attribute_mod@fied INT SET NOCOUNT ON -- Remove any leading/trailing spaces from parameters SELECT @new_name = LTRIM(RTRIM(@new_name)) SELECT @job_name = LTRIM(RTRIM(@job_name)) SELECT @notification_message = LTRIM(RTRIM(@notification_message)) SELECT @database_name = LTRIM(RTRIM(@database_name)) SELECT @event_description_keyword = LTRIM(RTRIM(@event_description_keyword)) SELECT @performance_condition = LTRIM(RTRIM(@performance_conditio@)) SELECT @category_name = LTRIM(RTRIM(@category_name)) -- Are we modifying an attribute which SQLServerAgent caches? IF ((@new_name IS NOT NULL) OR (@enabled IS NOT NULL) OR (@message_id IS NOT NULL) OR (@severity IS NOT NULL) OR (@delay_between_responses IS NOT NULL) OR (@notification_message IS NOT NULL) OR (@include_event_description_in IS NOT NULL@ OR (@database_name IS NOT NULL) OR (@event_description_keyword IS NOT NULL) OR (@job_id IS NOT NULL) OR (@job_name IS NOT NULL) OR  u u0gw (@last_response_date IS NOT NULL) OR (@last_response_time IS NOT NULL) OR (@raise_snmp_trap IS NOT NULL) OR (@performance_condition IS NOT NULL@) SELECT @cached_attribute_modified = 1 ELSE SELECT @cached_attribute_modified = 0 -- Map a job_id of 0 to the real value we use to mean 'no job' IF (@job_id = CONVERT(UNIQUEIDENTIFIER, 0x00)) AND (@job_name IS NULL) SELECT @job_name = N'' -- Only a sysadmin can do this IF (ISNULL(IS_SRVROLEMEMBER(N'sysadmin'), 0) <> 1) BEGIN RAISERROR(15003, 16, 1, N'sysadmin') RETURN(1) END -- Check if SQLServerAgent is in the process of starting EXECUTE @return_c@de = msdb.dbo.sp_is_sqlagent_starting IF (@return_code <> 0) RETURN(1) -- Failure -- Check if this Alert exists IF (NOT EXISTS (SELECT * FROM msdb.dbo.sysalerts WHERE (name = @name))) BEGIN RAISERROR(14262, 16, 1, '@name', @name) RETURN(1) END -- Certain values (if supplied) may only be updated to 0 IF (@occurrence_count <> 0) BEGIN RAISERROR(14266, -1, -1, '@occurrence_count', '0') RETURN(1) -- Failure END I@ (@last_occurrence_date <> 0) BEGIN RAISERROR(14266, -1, -1, '@last_occurrence_date', '0') RETURN(1) -- Failure END IF (@last_occurrence_time <> 0) BEGIN RAISERROR(14266, -1, -1, '@last_occurrence_time', '0') RETURN(1) -- Failure END IF (@last_response_date <> 0) BEGIN RAISERROR(14266, -1, -1, '@last_response_date', '0') RETURN(1) -- Failure END IF (@last_response_time <> 0) BEGIN RAISERROR(14266, -1, -1, '@last_response_time', '0') RETU@N(1) -- Failure END -- Get existing (@x_) values SELECT @alert_id = id, @x_enabled = enabled, @x_message_id = message_id, @x_severity = severity, @x_delay_between_responses = delay_between_responses, @x_notification_message = notification_message, @x_include_event_description = include_event_description, @x_database_name = database_name, @ @x_event_description_keyword = event_description_keyword, @x_occurrence_count = occurrence_count, @x_count_reset_date = count_reset_date, @x_count_reset_time = count_reset_time, @x_job_id = job_id, @x_last_occurrence_date = last_occurrence_date, @x_last_occurrence_time = last_occurrence_time, @x_last_response_date = last_response_date, @x_last_response_time @ = last_response_time, @x_flags = flags, @x_performance_condition = performance_condition, @x_category_id = category_id FROM msdb.dbo.sysalerts WHERE (name = @name) SELECT @x_job_id = sjv.job_id FROM msdb.dbo.sysalerts sa, msdb.dbo.sysjobs_view sjv WHERE (sa.job_id = sjv.job_id) AND (sa.name = @name) -- Fill out the values for all non-supplied parameters from the existsing values IF (@enabled @ IS NULL) SELECT @enabled = @x_enabled IF (@message_id IS NULL) SELECT @message_id = @x_message_id IF (@severity IS NULL) SELECT @severity = @x_severity IF (@delay_between_responses IS NULL) SELECT @delay_between_responses = @x_delay_between_responses IF (@notification_message IS NULL) SELECT @notification_message = @x_notification_message IF (@include_e@ent_description_in IS NULL) SELECT @include_event_description_in = @x_include_event_description IF (@database_name IS NULL) SELECT @database_name = @x_database_name IF H/:4SplitNextD w  n/@L x0L y v m L @ qL {0R rgweP |   s4 w:4 w0 v y0gw(@event_description_keyword IS NULL) SELECT @event_description_keyword = @x_event_description_keyword IF (@job_id IS NULL) AND (@job_name IS NULL) SELECT @job_id = @x_job_id IF (@occurrence_count IS NULL) SELECT @occurrence_count = @x_occurrence_count IF (@count_reset_date IS NULL) SELECT @count_reset_date = @x_count_reset_date IF (@count_reset_time IS NULL) SELECT @count_reset_time = @x_count_reset_time IF (@last_occurrence_date IS NULL) SELECT @last_occurrence_date = @x_last_occurrence_date IF (@last_occurrence_time IS NULL) SE@ECT @last_occurrence_time = @x_last_occurrence_time IF (@last_response_date IS NULL) SELECT @last_response_date = @x_last_response_date IF (@last_response_time IS NULL) SELECT @last_response_time = @x_last_response_time IF (@raise_snmp_trap IS NULL) SELECT @raise_snmp_trap = @x_flags & 0x1 IF (@performance_condition IS NULL) SELECT @performance_condition = @x_performance_condition IF (@category_name @ IS NULL) SELECT @category_name = name FROM msdb.dbo.syscategories WHERE (category_id = @x_category_id) IF (@category_name IS NULL) BEGIN SELECT @category_name = name FROM msdb.dbo.syscategories WHERE (category_id = 98) END -- Turn [nullable] empty string parameters into NULLs IF (@new_name = N'') SELECT @new_name = NULL IF (@notification_message = N'') SELECT @notification_message = NULL IF (@database_name @ = N'') SELECT @database_name = NULL IF (@event_description_keyword = N'') SELECT @event_description_keyword = NULL IF (@performance_condition = N'') SELECT @performance_condition = NULL -- Check if this alert would match an already existing alert SELECT @duplicate_name = FORMATMESSAGE(14205) SELECT @duplicate_name = name FROM msdb.dbo.sysalerts WHERE (ISNULL(performance_condition, N'') = ISNULL(@performance_condition, N'')) AND (message_id = @message_id) @ AND (severity = @severity) AND (ISNULL(database_name, N'') = ISNULL(@database_name, N'')) AND (ISNULL(event_description_keyword, N'') = ISNULL(@event_description_keyword, N'')) AND (name <> @name) IF (@duplicate_name <> FORMATMESSAGE(14205)) BEGIN RAISERROR(14501, 16, 1, @duplicate_name) RETURN(1) -- Failure END -- Verify the Alert IF (@job_id = CONVERT(UNIQUEIDENTIFIER, 0x00)) SELECT @job_id = NULL EXECUTE @return_code = sp_verify_alert @new_name, @ @message_id, @severity, @enabled, @delay_between_responses, @notification_message, @include_event_description_in, @database_name, @event_description_keyword, @ @job_id OUTPUT, @job_name OUTPUT, @occurrence_count, @raise_snmp_trap, @performance_condition, @category_name, @category_id OUTPUT, @count_reset_date, @count@reset_time IF (@return_code <> 0) RETURN(1) -- Failure -- If the user didn't supply a NewName, use the old one. -- NOTE: This must be done AFTER sp_verify_alert. IF (@new_name IS NULL) SELECT @new_name = @name -- Turn the 1L   _ 0gw_ st 'flags' bit on or off accordingly IF (@raise_snmp_trap = 0) SELECT @x_flags = @@x_flags & 0xFFFE ELSE SELECT @x_flags = @x_flags | 0x0001 -- Finally, do the actual UPDATE UPDATE msdb.dbo.sysalerts SET name = @new_name, message_id = @message_id, severity @ = @severity, enabled = @enabled, delay_between_responses = @delay_between_responses, notification_message = @notification_message, include_event_description = @include_event_description@_in, database_name = @database_name, event_description_keyword = @event_description_keyword, job_id = ISNULL(@job_id, CONVERT(UNIQUEIDENTIFIER, 0x00)), occurrence_count = @occurren@ce_count, count_reset_date = @count_reset_date, count_reset_time = @count_reset_time, last_occurrence_date = @last_occurrence_date, last_occurrence_time = @last_occurrence_time, last_re@sponse_date = @last_response_date, last_response_time = @last_response_time, flags = @x_flags, performance_condition = @performance_condition, category_id = @category@_id WHERE (name = @name) -- Notify SQLServerAgent of the change IF (@cached_attribute_modified = 1) EXECUTE msdb.dbo.sp_sqlagent_notify @op_type = N'A', @alert_id = @alert_id, @ @action_type = N'U' RETURN(0) -- Success END P    }P   P    ;P   4 :4 He {{8{zzm]\\@\[[\[[ZJ::l: :99<988l887`776h665l554p443t3 32x2$21|1(100,0// _~x\ AR(P_? _~x\  0) P_ < _ ~xv8 = T_ = _ sna e ~xv8P_ A _ ~x]!@fr @_ ~x4_   jP0*~xP ;4 Psp_delete_alertd_&,6~x,sp_delete_alertD_! l ~x _ {u 0~xu CREATE PROCEDURE sp_delete_alert @name sysname A@S BEGIN DECLARE @alert_id INT DECLARE @return_code INT SET NOCOUNT ON -- Remove any leading/trailing spaces from parameters SELECT @name = LTRIM(RTRIM(@name)) -- Only a sysadmin can do this IF (ISNULL(IS_SRVROLEMEMBER(N'sysad@min'), 0) <> 1) BEGIN RAISERROR(15003, 16, 1, N'sysadmin') RETURN(1) -- Failure END -- Check if SQLServerAgent is in the process of starting EXECUTE @return_code = msdb.dbo.sp_is_sqlagent_starting IF (@return_code <> 0) RETU@RN(1) -- Failure -- Check if this Alert exists IF (NOT EXISTS (SELECT * FROM msdb.dbo.sysalerts WHERE (name = @name))) BEGIN RAISERROR(14262, 16, 1, '@name', @name) RETURN(1) -- Failure END @ -- Convert the Name to it's ID SELECT @alert_id = id FROM msdb.dbo.sysalerts WHERE (name = @name) BEGIN TRANSACTION -- Delete sysnotifications entries DELETE FROM msdb.dbo.sysnotifications WHERE (alert_id = @alert_id) @ -- Finally, do the actual DELETE DELETE FROM msdb.dbo.sysalerts WHERE (id = @alert_id) COMMIT TRANSACTION -- Notify SQLServerAgent of the change EXECUTE msdb.dbo.sp_sqlagent_notify @op_type = N'A', @ @alert_id = @alert_id, @action_type = N'D' RETURN(0) -- Success END DoP_   P_ _P_ _  P_ H_4_;4_́C0<LLXhx$\p d Ld0Hq2 mpPe  Z4`/4`0XGGFpF$FEELE\5544443h3,3##H#""l"$""!d!! t $ 4$4Pl ,PiD c_(A sy.gzP`<4sp_help_alertniS!E0& syE@alert_namer`iUU_&6 sy&@alert_name^|iSiA0& syA@order_@by \iUVi"6 sy"@order_by|iSiA0& sy88 A@alert_id"\iUUi"6 sy"@alert_id_iSiK0& syK@category_namedi UWi,6 sy@,@category_namePi H _  syv8mPi H i  syv8_ i  syi  _L0* syP `<4 Lsp_help_alert`i3_(6 sy(sp_help_alertDi!_ @ syH/`<4SplitNext8iN/D0Li  x$/Di i$/@8i /)FDx8Li QLi_Q7 Li@Q, PP i i 0y --Identifies privileges granted to or by the current user create view INFORMATION_SCHEMA.TABLE_PRIVILEGES as select user_name(p.grantor) as GRANTOR ,user_name(p.uid) as GRANTEE ,@db_name() as TABLE_CATALOG ,user_name(o.uid) as TABLE_SCHEMA ,o.name as TABLE_NAME ,case p.action when 26 then 'REFERENCES' when 193 then 'SELECT' when 195 then 'INSERT' when 196 then 'DELETE' when 197 then 'UPDATE' end @ as PRIVILEGE_TYPE ,case when p.protecttype = 205 then 'NO' else 'YES' end as IS_GRANTABLE from sysprotects p, sysobjects o where (is_member(user_name(p.uid)) = 1 or p.grantor = user_id()) and (p.protecttype = 204 or @ /*grant exists without same grant with grant */ (p.protecttype = 205 and not exists(select * from sysprotects p2 where p2.id = p.id and p2.uid = p.uid and p2.action = p.action and p2.columns = p.columns and p2.grantor = p.g@rantor and p2.protecttype = 204))) and p.action in (26,193,195,196,197) and p.id = o.id and o.xtype in ('U', 'V') and 0 != (permissions(o.id) & case p.action when 26 then 4 /*REFERENCES basebit on all columns */ when 193 the@n 1 /*SELECT basebit on all columns */ when 195 then 8 /*INSERT basebit */ when 196 then 16 /*DELETE basebit */ when 197 then 2 /*UPDATE basebit on all columns */ end) OG<i i  x8Li0T | sH Pi  _4i`<4i0`8TT ht$<d,\GTABLE_SCHEMA0&˿wCTABLE_NAME0&˿w CTABLE_TYPE0&xSCONSTRAINT_CATALOG`0&xyP>ti i0 syCREATE PROCEDURE sp_help_alert @alert_name sysname = NULL, @order_by sysname = N'name', @alert_id INT = NULL, @category_name sysname = NULL AS BEGIN DECLARE @alert_id_as_char NVARCHAR(10) SET NOCOUNT ON -- Remove any leading/trailing spaces from parameters SELECT @alert_name = LTRIM(RTRIM(@alert_name)) SELECT @order_by = LTRIM(RTRIM(@order_by)) SEL@CT @category_name = LTRIM(RTRIM(@category_name)) -- Turn [nullable] empty string parameters into NULLs IF (@category_name = N'') SELECT @category_name = NULL IF (@alert_name = N'') SELECT @alert_name = NULL -- Check alert name IF (@alert_name IS NOT NULL) BEGIN IF (NOT EXISTS (SELECT * FROM msdb.dbo.sysalerts WHERE (name = @alert_name))) BEGIN RAISERROR(14262, -1, -1, '@alert_name', @alert_name) RETURN(1) -- Failure@ END END -- Check alert id IF (@alert_id IS NOT NULL) BEGIN IF (NOT EXISTS (SELECT * FROM msdb.dbo.sysalerts WHERE (id = @alert_id))) BEGIN SELECT @alert_id_as_char = CONVERT(VARCHAR, @alert_id) RAISERROR(14262, -1, -1, '@alert_id', @alert_id_as_char) RETURN(1) -- Failure END END IF (@order_by NOT LIKE N'job_name%') SELECT @order_by = N'sa.' + @order_by IF (@alert_id IS NOT NULL) SELECT @@lert_id_as_char = CONVERT(VARCHAR, @alert_id) ELSE SELECT @alert_id_as_char = N'NULL' -- Double up any single quotes in @alert_name IF (@alert_name IS NOT NULL) SELECT @alert_name = REPLACE(@alert_name, N'''', N'''''') -- Double up any single quotes in @category_name IF (@category_name IS NOT NULL) SELECT @category_name = REPLACE(@category_name, N'''', N'''''') EXECUTE (N'SELECT sa.id, sa.name, sa.event_source, @ sa.event_category_id, sa.event_id, sa.message_id, sa.severity, sa.enabled, sa.delay_between_responses, sa.last_occurrence_date, sa.last_occurrence_time, sa.last_response_date, sa.last_response_time, sa.notification_message, sa.include_event_description, @a.database_name, sa.event_description_keyword, sa.occurrence_count, sa.count_reset_date, sa.count_reset_time, sjv.job_id, job_name = sjv.name, sa.has_notification, sa.flags, sa.performance_condition, category_name = sc.name, type = CASE ISNULL(performance_condition, ''!'') @ WHEN ''!'' THEN CASE event_source WHEN ''MSSQLServer'' THEN 1 -- SQL Server event alert ELSE 3 -- Non SQL Server event alert END ELSE 2 -- SQL Server performance condition alert END FROM msdb.dbo.sysalerts sa @ LEFT OUTER JOIN msdb.dbo.sysjobs_view sjv ON (sa.job_id = sjv.job_id) LEFT OUTER JOIN msdb.dbo.syscategories sc ON (sa.category_id = sc.category_id) WHERE ((N''' + @alert_name + N''' = N'''') OR (sa.name = N''' + @alert_name + N''')) AND ((' + @alert_id_as_char + N' IS NULL) OR (sa.id = ' + @alert_id_as_char + N')) AND ((N''' + @category_name + N''' = N'''') OR (sc.name = N''' + @category_name + N''')) ORDER BY ' + @@rdert t{0 sy{_by) RETURN(@@error) -- 0 means success END Pt  iPt tPt t Pt t4Hi`<4i \ rt_date = @activestartdate, @active_end_date = @activeenddate, @active_start_time = @activestarttimeofday, @active_end_time = @activeendtimeofday END o s a EP=;<~D ci(A.gzKR[{XA=4$sp_verify_operatort~Si 90&.gz9@name(@T~U`i 6.gz@namex~S~?0&.gz00?@enabledX~@U`~ 6.gz @enabled~S~E0&.gz00E@pager_days/4`~Ub~&6.gz&@pager_days_p~S~a0&.gz88 a@weekday_pager_start_time |~ Uc~B@.gzB@weekday_pager_start_time~ S~ ]0&.gz88 ]@weekday_pager_end_timex~ Uc~ >6.gz>@weekday_pager_end_time~ S~ c0&.gz88 c@saturday_pager_start_timeH@/A=4SplitNextD~ i/@L~U TL~U~ TPP~ tL~Tt bU0~~T"&,"(,*$( @>B@<:482,0,&"4,&*&2>*0*$(&,&**$(&(,*$(@<:482,0"4,,&*2>*4.2,&*4*&4.206 sy"@alert_id6 sy&@alert_name6 sy,@category_name6 sy"@order_by6yGRANTEE6yGRANTOR6y(IS_GRANTABLE6y,PRIVILEGE_TYPE6y*TABLE_CATALOG6y$TA@LE_NAME6y(TABLE_SCHEMA6.gz @enabled6.gz@name6.gz&@pager_days6.gz>@weekday_pager_end_time6.gzB@weekday_pager_start_timep6<8z @CHARACTER_MAXIMUM_LENGTH6<8z <CHARACTER_OCTET_LENGTH6<8z:CHARACTER_SET_CATALOG6<8z4CHARACTER_SE@_NAME6<8z8CHARACTER_SET_SCHEMA6<8z2COLLATION_CATALOG6<8z,COLLATION_NAME6<8z0COLLATION_SCHEMA6<8z,COLUMN_DEFAULT6<8z&COLUMN_NAME6<8z"DATA_TYPE6<8z4DATETIME_PRECISION6<8z,DOMAIN_CATALOG6<8z&DOMAIN_NAME6<8z*DOMAIN_SCHEMAE @<8z&IS_NULLABLEsn6<8z 2NUMERIC_PRECISIONme6<8z >NUMERIC_PRECISION_RADIX 6<8z *NUMERIC_SCALE 6<8z0ORDINAL_POSITION6<8z*TABLE_CATALOG((6<8z$TABLE_NAME6<8z(TABLE_SCHEMA6u\{&COLUMN_NAME((6u\{,DOMAIN_CATALOG6u\{&DOMAIN_NAMEL)6u\{*DO@AIN_SCHEMAIS6u\{*TABLE_CATALOGNU6u\{$TABLE_NAME6u\{(TABLE_SCHEMA6|&COLUMN_NAME--6|GRANTEE n6|GRANTORd 6|(IS_GRANTABLE6|,PRIVILEGE_TYPE6|*TABLE_CATALOG 6|$TABLE_NAME6|(TABLE_SCHEMA6x}@CHARACTER_MAXIMUM_LENG@H6x}<CHARACTER_OCTET_LENGTH6x} :CHARACTER_SET_CATALOGie6x} 4CHARACTER_SET_NAME6x} 8CHARACTER_SET_SCHEMA6x}2COLLATION_CATALOG 6x} ,COLLATION_NAME6x}0COLLATION_SCHEMA6x}"DATA_TYPEe 6x}4DATETIME_PRECISION6x},DOMAIN_CATALOG6x@,DOMAIN_DEFAULT6x}&DOMAIN_NAMEhe6x}*DOMAIN_SCHEMAEC6x} 2NUMERIC_PRECISIONw 6x}>NUMERIC_PRECISION_RADIX 6x}*NUMERIC_SCALE 6 l~4CONSTRAINT_CATALOG6 l~.CONSTRAINT_NAMEam6 l~2CONSTRAINT_SCHEMAid6 l~,DOMAIN_CATALOG6 l~&DOMAIN_N@MED 6 l~*DOMAIN_SCHEMAme6 l~4INITIALLY_DEFERRED6 l~*IS_DEFERRABLEE 6Y`&COLUMN_NAMEl 6Y`4CONSTRAINT_CATALOG6Y`.CONSTRAINT_NAMEOT6Y`2CONSTRAINT_SCHEMAk,6Y`0ORDINAL_POSITION<~ UU~Tx8`~# N&6 sy@&@alert_id0)P~ ~4~F=4~0T|~ ~D6.gzD@saturday_pager_start_time~S~ _0&.gz88 _@saturday_pager_end_time)x~~@6.gz@@saturday_pager_end_time~S~_0&.gz88 _@sunday_pager_start_time x~~@6.gz@@sunday_pager_start_time~S~[0&.gz88  [@sunday_pager_end_timet~~@<6.gz <@sunday_pager_end_time~S~K0&.gz  K@category_name d~  ~,6.gz ,@category_name~!S~ G0&.gz88  G@category_id `~" ~!(6.gz (@cat@gory_idP~#T i .gz#,LP~$U ~$.gz DR>P~%T ~%.gzsP~&T ~&.gzsP~'T ~'.gzsGP~(T ~(.gzssk ~)@.gz4~* iV0*.gzP F=4 Vsp_verify_operatorl~+ k26.gz2sp_verify_operatorD~,!i .gzH/F=4SplitNextD~. ~%/@L~/!@ QL~0 tQ!L~1Qi !P ~2!~0 0y --Identifies privileges granted to or by the current user create view INFORMATION_SCHEMA.TABLE_PRIVILEGES as select @ user_name(p.grantor) as GRANTOR ,user_name(p.uid) as GRANTEE ,db_name() as TABLE_CATALOG ,user_name(o.uid) as TABLE_SCHEMA ,o.name as TABLE_NAME ,case p.action when 26 then 'REFERENCES' when 193 then 'SELECT' when 195 then '@INSERT' when 196 then 'DELETE' when 197 then 'UPDATE' end as PRIVILEGE_TYPE ,case when p.protecttype = 205 then 'NO' else 'YES' end as IS_GRANTABLE from sysprotects p, sysobjects o where (is_member(user_name(p.uid)@) = 1 or p.grantor = user_id()) and (p.protecttype = 204 or /*grant exists without same grant with grant */ (p.protecttype = 205 and not exists(select * from sysprotects p2 where p2.id = p.id and p2.uid = p.uid and p2.action =@ p.action and p2.columns = p.columns and p2.grantor = p.grantor and p2.protecttype = 204))) and p.action in (26,193,195,196,197) and p.id = o.id and o.xtype in ('U', 'V') and 0 != (permissions(o.id) & case p.action when 26@ then 4 /*REFERENCES basebit on all columns */ when 193 then 1 /*SELECT basebit on all columns */ when 195 then 8 /*INSERT basebit */ when 196 then 16 /*DELETE basebit */ when 197 then 2 /*UPDATE basebit on all columns */ @end) <~3  ~1! x8L~40Uiy!P~5  ~4~.F=4~.0 ~-!~3w 0.gzw CREATE PROCEDURE sp_verify_operator @name sysname, @enabled TINYINT, @pager_days TINYINT@ @weekday_pager_start_time INT, @weekday_pager_end_time INT, @saturday_pager_start_time INT, @saturday_pager_end_time INT, @sunday_pager_start_time INT, @sunday_pager_end_time INT, @category_name sysname, @category_id INT OUTPUT AS BEGIN DECLARE @return_code TINYINT DECLARE @res_valid_range NVARCHAR(100) SET NOCOUNT ON SELECT @res_valid_range = FORMATMESSAGE(14209) -- Remove any leading/trailing spaces from parameters @ SELECT @name = LTRIM(RTRIM(@name)) SELECT @category_name = LTRIM(RTRIM(@category_name)) -- The name must be unique IF (EXISTS (SELECT * FROM msdb.dbo.sysoperators WHERE (name = @name))) BEGIN RAISERROR(14261, 16, 1, '@name', @name) RETURN(1) -- Failure END -- Enabled must be 0 or 1 IF (@enabled NOT IN (0, 1)) BEGIN RAISERROR(14266, 16, 1, '@enabled', '0, 1') RETURN(1) -- Failure END -- Check PagerDays IF (@p@ger_days < 0) OR (@pager_days > 127) BEGIN RAISERROR(14266, 16, 1, '@pager_days', @res_valid_range) RETURN(1) -- Failure END -- Check Start/End Times EXECUTE @return_code = sp_verify_job_time @weekday_pager_start_time, '@weekday_pager_start_time' IF (@return_code <> 0) RETURN(1) EXECUTE @return_code = sp_verify_job_time @weekday_pager_end_time, '@weekday_pager_end_time' IF (@return_code <> 0) RETURN(1) EXECUTE @return_code = sp_verify_job_time @saturday_pag@r_start_time, '@saturday_pager_start_time' IF (@return_code <> 0) RETURN(1) EXECUTE @return_code = sp_verify_job_time @saturday_pager_end_time, '@saturday_pager_end_time' IF (@return_code <> 0) RETURN(1) EXECUTE @return_code = sp_verify_job_time @sunday_pager_start_time, '@sunday_pager_start_time' IF (@return_code <> 0) RETURN(1) EXECUTE @return_code = sp_verify_job_time @sunday_pager_end_time, '@sunday_pager_end_time' IF (@return_code <> 0) RETURN(1) -- @heck category name IF (@category_name = N'[DEFAULT]') SELECT @category_id = 99 ELSE BEGIN SELECT @category_id = category_id FROM msdb.dbo.syscategories WHERE (category_class = 3) -- Operators AND (category_type = 3) -- None AND (name = @category_name) END IF (@category_id IS NULL) BEGIN RAISERROR(14262, -1, -1, '@category_name', @category_name) RETURN(1) -- Failure END RETURN(0) END 'P~8  ~6HP~9 ~9P~: ~:  P~; ~; 4~F=4~́C0 ;:l::9/..L.."t"("!!P! !  P`0H@0 p d|8TD,L|(\ = SUSER_SNAME(sjv.owner_sid), Cea ,e@A}TM6TB&6PO=><D c~(AKR[{vO|T">4sp_add_operator tS0~"90&KR[{9@name T-~#6KR[{@name xS1?0&KR[{00?@enabledqX@- 6KR[{ @enabledS2K0&KR[{K@email_addressId-,6KR[{,@email_addressS3K0&KR[{K@pager_address d 0,6KR[{,@p@ger_address S4 a0&KR[{88 a@weekday_pager_start_timetem| 1 B6KR[{B@weekday_pager_start_time H/'>4SplitNextD  ~// @ LS&@LS  js2KaKIEIGCE==IGCEKGKIEA_[QOKYWSQ]ISKSQMKIEISSQMIGCEO0&KR[{K@pager_address 0&KR[{88 a@weekday_pager_start_time0&u\{KDOMAIN_CATALOG0&u\{@IDOMAIN_SCHEMA0&u\{EDOMAIN_NAME0&u\{ITABLE_CATALOG0&u\{GTABLE_SCHEMA0&u\{CTABLE_NAME0&u\{ECOLUMN_NAME0&|=GRANTOR0&|@=GRANTEE0&|ITABLE_CATALOG0&|GTABLE_SCHEMA 0&|CTABLE_NAMEs0&|ECOLUMN_NAME 0&| KPRIVILEGE_TYPE 0&|GIS_GRANTABLEs0&x}@KDOMAIN_CATALOGT0&x}IDOMAIN_SCHEMA 0&x}EDOMAIN_NAMEo.s0&x}ADATA_TYPEjob0&x}44_CHARACTER_MAXIMUM_LENGTHi0&x}44[CHARACTER_OCTET_LENGTHt0&x}QCOLLATION_CATAL@OG (s0&x}OCOLLATION_SCHEMA)0&x} KCOLLATION_NAME 0&x} YCHARACTER_SET_CATALOG IS0&x} WCHARACTER_SET_SCHEMAU0&x} SCHARACTER_SET_NAMES0&x}00 QNUMERIC_PRECISION @&x}44]NUMERIC_PRECISION_RADIX 0&x}00INUMERIC_SCALEata0&x}44SDATETIME_PRECISION)0&x}@KDOMAIN_DEFAULT 0& l~SCONSTRAINT_CATALOGj0& l~QCONSTRAINT_SCHEMA = 0& l~@MCONSTRAINT_NAMELL)0& l~KDOMAIN_CATALOG 0& l~IDOMAIN_SCHEMAope0& l~EDOMAIN_NAME) 0& l~IIS_DEFERRABLEtas0& l~SINITIALLY_DEFERREDa0&Y`SCONSTRA@INT_CATALOG0&Y`QCONSTRAINT_SCHEMA0&Y`MCONSTRAINT_NAME0&Y`ITABLE_CATALOG0&Y`GTABLE_SCHEMA0&Y`CTABLE_NAME0&Y`ECOLUMN_NAME00&Y`44@OORDINAL_POSITIONT< S32x8L$KR[{opP ~<4 '>4 8 ]0&KR[{88 ]@weekday_pager_end_timeAR(x1 @>6KR[{>@weekday_pager_end_timec0&KR[{88 c@saturday_pager_start_time |1D6KR[{D@saturday_pager_start_time_0&KR[{88 _@saturday_pager_end_time x@1@6KR[{@@saturday_pager_end_time_0&KR[{88  _@sunday_pager_start_time x3@6KR[{ @@sunday_pager_start_time[0&KR[{88  [@sunday_pager@_end_timet3<6KR[{ <@sunday_pager_end_timeE0&KR[{00  E@pager_daysas_` 1&6KR[{ &@pager_daysGE! O0&KR[{  O@netsend_addresseh"@0!06KR[{ 0@netsend_address# "K0&KR[{  K@category_namecd$-#,6KR[{ ,@category_nameP%n ~)KR[{sd_eP&n &KR[{s msP'p@'KR[{.gzP(p (KR[{#,P)q )KR[{#,LP*r *KR[{#,skP+s +KR[{#,P,t ,KR[{#,oP-u -KR[{@,P.v .KR[{#,P/w /KR[{#, P0x 0KR[{#, P1y 1KR[{#, P2z 2KR[{#, P3{ 3KR[{#, P4@| 4KR[{#,PP5} 5KR[{#,dP6~ 6KR[{#,eP7 7KR[{#,P8 8KR[{#,P9 9KR[{#,AR(P: :@KR[{#,ron ;KR[{<~+P0*KR[{P '>4 Psp_add_operatord=i,6KR[{,sp_add_operatorD>!~- KR[{H/'>4SplitNextD@ &/ @ANDL@A"QRLBQ~2R"LCRjQ"|D"BA0u\{A --Identifies columns owned by current user that has a user defined datatype create view INFORMATION_SCHEMA.COLUMN_DOMAIN_USAGE as select db_name() as DOMAIN_CATALOG ,user_name(typ.uid) as DOMAIN_SCHE@A ,typ.name as DOMAIN_NAME ,db_name() as TABLE_CATALOG ,user_name(obj.uid) as TABLE_SCHEMA ,obj.name as TABLE_NAME ,col.name as COLUMN_NAME FROM sysobjects obj ,syscolumns col ,systypes typ WHERE obj.uid = user_id() AND obj.id = col.id AND col.xusertype = typ.xusertype AND typ.xusertype > 256 -- UDF Type li<E QC"Fx8LF0W~5KR[{"sPG @ 4@'>4@0d?"E+0KR[{+CREATE PROCEDURE sp_add_operator @name sysname, @enabled TINYINT = 1, @email_address NVARCHAR(100) = NULL, @pager_address NVARCHAR(100) = NULL, @weekday_pager_start_time INT = 090000, -- HHMMSS using 24 hour clock @weekday_pager_end_@ime INT = 180000, -- As above @saturday_pager_start_time INT = 090000, -- As above @saturday_pager_end_time INT = 180000, -- As above @sunday_pager_start_time INT = 090000, -- As above @sunday_pager_end_time INT = 180000, -- As above @pager_days TINYINT = 0, -- 1 = Sunday .. 64 = Saturday @netsend_address NVARCHAR(100) = NULL, -- New for 7.0 @category_name sysname = NULL@ -- New for 7.0 AS BEGIN DECLARE @return_code TINYINT DECLARE @category_id INT SET NOCOUNT ON -- Remove any leading/trailing spaces from parameters SELECT @name = LTRIM(RTRIM(@name)) SELECT @email_address = LTRIM(RTRIM(@email_address)) SELECT @pager_address = LTRIM(RTRIM(@pager_address)) SELECT @netsend_address = LTRIM(RTRIM(@netsend_address)) SELECT @category_name = LTRIM(RTRIM(@category_name)) -- Turn [nullable] empty string parameters into NULLs @ IF (@email_address = N'') SELECT @email_address = NULL IF (@pager_address = N'') SELECT @pager_address = NULL IF (@netsend_address = N'') SELECT @netsend_address = NULL IF (@category_name = N'') SELECT @category_name = NULL -- Only a sysadmin can do this IF (ISNULL(IS_SRVROLEMEMBER(N'sysadmin'), 0) <> 1) BEGIN RAISERROR(15003, 16, 1, N'sysadmin') RETURN(1) -- Failure END IF (@category_name IS NULL) BEGIN SELECT @category_name = name FROM msdb.@bo.syscategories WHERE (category_id = 99) END -- Verify the operator EXECUTE @return_code = sp_verify_operator @name, @enabled, @pager_days, @weekday_pager_start_time, @weekday_pager_end_time, @saturday_pager_start_time, @sat@rday_pager_end_time, @sunday_pager_start_time, @sunday_pager_end_time, @category_name, @category_id OUTPUT IF (@return_code <> 0) RETURN(1) -- Failure -- Finally, do the INSERT INSERT INTO msdb.dbo.sysoperators (name, enabled, email_address, last_email_date, la@t_email_time, pager_address, last_pager_date, last_pager_time, weekday_pager_start_time, weekday_pager_end_time, saturday_pager_start_time, saturday_pager_end_time, sunday_pager_start_time, sunday_pager_end_time, pager_days, netsend_address, last_netsend_date, last_netsend_time, category_id) VALUES (@name, @enabled, @email_address@ 0, 0, @pager_address, 0, 0, @weekday_pager_start_time, @weekday_pager_end_time, @saturday_pager_start_time, @saturday_pager_end_time, @sunday_pager_start_time, @sunday_pager_end_time, @pager_days, @netsend_address, 0, 0, @category_id) RETURN(@@error) -- 0 means success END LPJ  HHPK KPL L PM M 4'>4́C0 =D c(AvO|C}X ?4$sp_update_operatort$90&vO|9@nameTA%6vO|@name0|A0&vO|A@new_namein\@B"6vO|"@new_namewx?0&vO|00?@enabledXA 6vO| @enabledK0&vO|K@email_addressd A,6vO|,@email_a@dress  K0&vO|K@pager_addressd E ,6vO|,@pager_address  a0&vO|88 a@weekday_pager_start_time$| F B6vO|B@weekday_pager_start@timet ]0&vO|88 ]@weekday_pager_end_timecxF>6vO|>@weekday_pager_end_timec0&vO|88 c@saturday_pager_start_time|FD6vO|D@saturday_pager_start_time_0&vO|88  _@saturday_pager_end_timexF@6vO| @@saturday_pager_end_time_0&vO|88  _@sunday_pager_start_time xH@@6vO| @@sunday_pager_start_time[0&vO|88  [@sunday_pager_end_timetH<6vO| <@sunday_pager_end_timeE0&vO|00  E@pager_days`F@&6vO| &@pager_daysyO0&vO|  O@netsend_addresshD06vO| 0@netsend_addressK0&vO|K@category_namedA,6vO|,@cat@gory_nameP ;vO|#,nP vO|#,oP   vO|#,eP! !vO|#,2 P" "vO|#,eP# #vO|#,vP@ $vO|#, P% %vO|#, eP& &vO|#, 2 P' 'vO|#, 2 P( (vO|#,(P) )vO|#,P* @vO|#,oP+ +vO|syP, ,vO|s$P- -vO|.gzaT. .onvO|#,T/ /f{vO|#,T0 0t@vO|#,T1 1snvO|#,T2 2vO|#, T3 3mtvO|#, T4 4vO|#, T5 5YvO|#, T6 6vO|#@,T7 7vO|#,T8 8vO|#,T9 9vO|#,T: :vO|#,T; ; vO|#,P< <vO|gP@= =vO|zz&P> >vO|]!@ ?vO|4@=V0*vO|P ?4 Vsp_update_operator@lA~,26vO|2sp_update_operatorDB!? vO|H@/?4SplitNextDD A'/N@_LE#"RLF"JR#LGRD"r#mLH0XGvO|#IPI  N@4D?4D0C#F0vO|CREATE PROCEDURE sp_update_operator @name sysname, @new_name sysname = NULL, @enabled TINYINT = NULL, @email_address NVARCHAR(100) = NULL, @pager_address NVARCHAR(100) = NULL, @weekday_pager_start_time INT = NULL, -- HHMMSS using 24 hour clock @weekda@_pager_end_time INT = NULL, -- As above @saturday_pager_start_time INT = NULL, -- As above @saturday_pager_end_time INT = NULL, -- As above @sunday_pager_start_time INT = NULL, -- As above @sunday_pager_end_time INT = NULL, -- As above @pager_days TINYINT = NULL, @netsend_address NVARCHAR(100) = NULL, -- New for 7.0 @category_name sysname = NULL -- New for 7.0 AS BEGIN DE@LARE @x_enabled TINYINT DECLARE @x_email_address NVARCHAR(100) DECLARE @x_pager_address NVARCHAR(100) DECLARE @x_weekday_pager_start_time INT DECLARE @x_weekday_pager_end_time INT DECLARE @x_saturday_pager_start_time INT DECLARE @x_saturday_pager_end_time INT DECLARE @x_sunday_pager_start_time INT DECLARE @x_sunday_pager_end_time INT DECLARE @x_pager_days TINYINT DECLARE @x_netsend_address NVARCHAR(@00) DECLARE @x_category_id INT DECLARE @return_code INT DECLARE @notification_method INT DECLARE @alert_fail_safe_operator sysname DECLARE @current_msx_server NVARCHAR(30) DECLARE @category_id INT SET NOCOUNT ON -- Remove any leading/trailing spaces from parameters SELECT @name = LTRIM(RTRIM(@name)) SELECT @new_name = LTRIM(RTRIM(@new_name)) SELECT @email_address = LTRIM(RTRIM(@email@address)) SELECT @pager_address = LTRIM(RTRIM(@pager_address)) SELECT @netsend_address = LTRIM(RTRIM(@netsend_address)) SELECT @category_name = LTRIM(RTRIM(@category_name)) -- Only a sysadmin can do this IF (ISNULL(IS_SRVROLEMEMBER(N'sysadmin'), 0) <> 1) BEGIN RAISERROR(15003, 16, 1, N'sysadmin') RETURN(1) -- Failure END -- Check if this Operator exists IF (NOT EXISTS (SELECT * FROM msdb.dbo.sysoperators WHERE (name = @name)@) BEGIN RAISERROR(14262, 16, 1, '@name', @name) RETURN(1) -- Failure END -- Check if this operator is 'MSXOperator' IF (@name = N'MSXOperator') BEGIN -- Disallow the update operation if we're at a TSX for all callers other than xp_msx_enlist EXECUTE master.dbo.xp_regread N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\SQLServerAgent', N'MSXServerName', @curr@nt_msx_server OUTPUT, N'no_output' IF ((@current_msx_server IS NOT NULL) AND (PROGRAM_NAME() <> N'xp_msx_enlist')) BEGIN RAISERROR(14223, 16, 1, 'MSXOperator', 'TSX') RETURN(1) -- Failure END END -- Get existing (@x_) operator property values SELECT @x_enabled = enabled, @x_email_address = email_address, @x_pager_address = pager_address, @x_weekday_pager_start@time = weekday_pager_start_time, @x_weekday_pager_end_time = weekday_pager_end_time, @x_saturday_pager_start_time = saturday_pager_start_time, @x_saturday_pager_end_time = saturday_pager_end_time, @x_sunday_pager_start_time = sunday_pager_start_time, @x_sunday_pager_end_time = sunday_pager_end_time, @x_pager_days = pager_days, @x_netsend_address = netsend_address, @x_category_id @ = category_id FROM msdb.dbo.sysoperaeL#L0vO|tors WHERE (name = @name) -- Fill out the values for all non-supplied parameters from the existsing values IF (@enabled IS NULL) SELECT @enabled = @x_enabled IF (@email_address IS NULL) SELECT @email_address = @x_email_address IF (@pager_address IS NULL) SELECT @pager_address = @x_pager_ad@ress IF (@weekday_pager_start_time IS NULL) SELECT @weekday_pager_start_time = @x_weekday_pager_start_time IF (@weekday_pager_end_time IS NULL) SELECT @weekday_pager_end_time = @x_weekday_pager_end_time IF (@saturday_pager_start_time IS NULL) SELECT @saturday_pager_start_time = @x_saturday_pager_start_time IF (@saturday_pager_end_time IS NULL) SELECT @saturday_pager_end_time = @x_saturday_pager_end_time IF (@sunday_pager_start_time IS NULL) SELECT @sunday_pager_start_time = @@_sunday_pager_start_time IF (@sunday_pager_end_time IS NULL) SELECT @sunday_pager_end_time = @x_sunday_pager_end_time IF (@pager_days IS NULL) SELECT @pager_days = @x_pager_days IF (@netsend_address IS NULL) SELECT @netsend_address = @x_netsend_address IF (@category_name IS NULL) SELECT @category_name = name FROM msdb.dbo.syscategories WHERE (category_id = @x_category_id) IF (@category_name IS NULL) BEGIN SELECT @category_name = name FROM msdb.dbo.syscategories WHERE (category_id = 99) END -- Turn [nullable] empty string parameters into NULLs IF (@email_address = N'') SELECT @email_address = NULL IF (@pager_address = N'') SELECT @pager_address = NULL IF (@netsend_address = N'') SELECT @netsend_address = NULL IF (@category_name = N'') SELECT @category_name = NULL -- Verify the operator EXECUTE @return_code = sp_verify_operator @new_name, @ @enabled, @pager_days, @weekday_pager_start_time, @weekday_pager_end_time, @saturday_pager_start_time, @saturday_pager_end_time, @sunday_pager_start_time, @sunday_pager_end_time, @ @category_name, @category_id OUTPUT IF (@return_code <> 0) RETURN(1) -- Failure -- If no new name is supplied, use the old one -- NOTE: We must do this AFTER calling sp_verify_operator. IF (@new_name IS NULL) SELECT @new_name = @name ELSE BEGIN -- You can't rename the MSXOperator IF (@name = N'MSXOperator') BEGIN RAISERROR(14222, 16, 1, 'MSXOperator') RETURN(1) -@ Failure END END -- Do the UPDATE UPDATE msdb.dbo.sysoperators SET name = @new_name, enabled = @enabled, email_address = @email_address, pager_address = @pager_address, weekday_pager_start_time = @weekday_pager_start_time, weekday_pager_end_time = @weekday_pager_end_time, saturday_pager_start_time = @saturday_pager_start_time, saturday_pager_end_time = @saturday_pager_end@time, sunday_pager_start_time = @sunday_pager_start_time, sunday_pager_end_time = @sunday_pager_end_time, pager_days = @pager_days, netsend_address = @netsend_address, category_id = @category_id WHERE (name = @name) -- Check if the operator is 'MSXOperator', in which case we need to re-enlist all the targets -- so that they will download the new MSXOperator details IF ((@name = N'MSXOperator') AND ((SELECT COUNT(*@ FROM msdb.dbo.systargetVH/?4SplitNextDN E(/_@aLO$0#RLP#MR$_LQRH#c$oLR0YIvO|$iPS  @J4N?4N0H M$P 0vO| servers) > 0)) EXECUTE msdb.dbo.sp_post_msx_operation 'RE-ENLIST', 'SERVER', 0x00 -- Check if this operator is the FailSafe Operator EXECUTE master.dbo.xp_regread N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\SQLServerAgent', N'AlertFailSafeOperator', @ @alert_fail_safe_operator OUTPUT, N'no_output' -- If it is, we update the 4 'AlertFailSafe...' registry entries and AlertNotificationMethod IF (LTRIM(RTRIM(@alert_fail_safe_operator)) = @name) BEGIN -- Update AlertFailSafeX values EXECUTE master.dbo.xp_regwrite N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\SQLServerAgent', N'AlertFailSafeOper@tor', N'REG_SZ', @new_name EXECUTE master.dbo.xp_regwrite N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\SQLServerAgent', N'AlertFailSafeEmailAddress', N'REG_SZ', @email_address EXECUTE master.dbo.xp_regwrite N'HKEY_LOCAL_MACHINE', N'SOFT@ARE\Microsoft\MSSQLServer\SQLServerAgent', N'AlertFailSafePagerAddress', N'REG_SZ', @pager_address EXECUTE master.dbo.xp_regwrite N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\SQLServerAgent', N'AlertFailSafeNetSendAddress', N'REG_SZ', @nets@nd_address -- Update AlertNotificationMethod values EXECUTE master.dbo.xp_regread N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\SQLServerAgent', N'AlertNotificationMethod', @notification_method OUTPUT, N'no_output' IF (LTRIM(RTRIM(@email_address)) IS NULL) SELECT @notification_method = @notification_method & ~1 IF (LTRIM(RTRIM(@p@ger_address)) IS NULL) SELECT @notification_method = @notification_method & ~2 IF (LTRIM(RTRIM(@netsend_address)) IS NULL) SELECT @notification_method = @notification_method & ~4 EXECUTE master.dbo.xp_regwrite N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\SQLServerAgent', N'AlertNotificationMethod', N'REG_DWORD', @notification_me@hod -- And finally, let SQLServerAgent know of the changes EXECUTE msdb.dbo.sp_sqlagent_notify @op_type = N'G' END RETURN(0) -- Success END +PV  TPW WPX X $PY Y4?4HT()KKDKJJ\>(>==@=<2sp_verify_job_taeWa )_- @xd _e)_1Cy*$e@_dP ND c(AC}7~X?4$sp_delete_operatort'90&C}9@namesTW6C}@namee(Y0&C}Y@reassign_to_op@eratorotX:6C}:@reassign_to_operatorsP ?C}#,iP C}glP C}#,sP   C}\ sT   @s sC}\ P   C}\  eP   C}\ iP   C} rP C} cP C}  sP C} P@ C}#,eT i wC}#, C}4AV0*C}P ?4 Vsp_delete_operatorBl%>26C}2sp_delete_operatorD!C C}HH/?4SplitNextD O)/@L%RXLRRXI%vLXj R% DLHXht$|(\H/34SplitNextXP   %M @0x}M --Identifies user defined datatype accessible to current user. create view INFORMATION_SCHEMA.DOMAINS as select DB_NAME() as DOMAIN_CATALOG ,USER_NAME(typ.uid) as DOMAIN_SCHEMA ,typ.name as DOMAIN_NAME ,spt_dtp.LOCAL_TYPE_NAME as DATA_TYPE ,typ.length + spt_dtp.charbin as CHARACTER_MAXIMUM_LENGTH ,typ.prec + spt_dtp.charbin as CHARACTER_OCTET_LENGTH ,case when spt_dt@.LOCAL_TYPE_NAME in ('char', 'varchar', 'text', 'nchar', 'nvarchar', 'ntext') then 'master' else NULL end as COLLATION_CATALOG ,case when spt_dtp.LOCAL_TYPE_NAME in ('char', 'varchar', 'text', 'nchar', 'nvarchar', 'ntext') then 'dbo' else NULL end as COLLATION_SCHEMA ,case when spt_dtp.LOCAL_TYPE_NAME in ('char', 'varchar', 'text', 'nchar', 'nvarchar', 'ntext') then b_cha.name else NULL end as COLLATION_NAME ,case when spt_dtp.LOCA@_TYPE_NAME in ('char', 'varchar', 'text', 'nchar', 'nvarchar', 'ntext') then 'master' else NULL end as CHARACTER_SET_CATALOG ,case when spt_dtp.LOCAL_TYPE_NAME in ('char', 'varchar', 'text', 'nchar', 'nvarchar', 'ntext') then 'dbo' else NULL end as CHARACTER_SET_SCHEMA ,case when spt_dtp.LOCAL_TYPE_NAME in ('char', 'varchar', 'text', 'nchar', 'nvarchar', 'ntext') then a_cha.name else NULL end as CHARACTER_SET_NAME ,nullif(typ.xprec, @) as NUMERIC_PRECISION ,spt_dtp.RADIX as NUMERIC_PRECISION_RADIX ,typ.scale as NUMERIC_SCALE ,spt_dtp.SQL_DATETIME_SUB as DATETIME_PRECISION ,com.text as DOMAIN_DEFAULT FROM master.dbo.spt_datatype_info spt_dtp, systypes typ LEFT OUTER JOIN syscomments com on typ.tdefault = com.id AND com.colid = 1, master.dbo.sysconfigures cfg, master.dbo.syscharsets a_cha, --charset/1001, not sortorder. master.dbo.syscharsets b_cha --sortorder/2001, not charset. WHERE typ.xty@e = spt_dtp.ss_dtype AND (spt_dtp.ODBCVer is null or spt_dtp.ODBCVer = 2) -- Use 7.0 entries AND spt_dtp.AUTO_INCREMENT in ( 0, null) -- Remove auto increment types AND cfg.comment = 'default sortorder id' AND a_cha.type = 1001 --- type is charset AND b_cha.type = 2001 -- type is sortorder AND a_cha.id = b_cha.csid AND b_cha.id = cfg.value AND typ.xusertype > 256 -- UDF Type 0 l~@ --Identifies user defined datatype accessible to current user, that h@ve constraints create view INFORMATION_SCHEMA.DOMAIN_CONSTRAINTS as select DB_NAME() as CONSTRAINT_CATALOG ,USER_NAME(obj.uid) as CONSTRAINT_SCHEMA ,obj.name as CONSTRAINT_NAME ,DB_NAME() as DOMAIN_CATALOG ,USER_NAME(typ.uid) as DOMAIN_SCHEMA ,typ.name as DOMAIN_NAME ,'NO' as IS_DEFERRABLE ,'NO' as INITIALLY_DEFERRED FROM sysobjects obj, systypes typ WHERE obj.xtype = 'R' and obj.id = typ.domain AND typ.xusertype > 256 -- UDF Type < RH% x8L0[SC}%rP  Z4?40 l systargetservers_view6"systaskids 6@ 0@?P 0>` 0[@?p 0> 0N@? 0> 0M@? 0(T!{ 0 0Ѐ 0(0 0 0a@ 0> 0C@? 0> 0@@?@0 0>@ 0?@??P 0>` 0>@?@p 0> 0=@?@ 0T!{H 0 0 0Q0 0(؁ 0 0a@ 0Ё 0> 0:@?@ 0> 09@?? 0> 08@?@0 0>@ 07@?@P 0>` 06@ 0p 0!P8z 0H 0 0 0F 0Cz  0 0 0F 00@ 0@Ђ 0 02@| 0 0 08z  0 0 0 088 0P 0  00 0 0@ 0P8zP 0 00 0` 0Fp 0H;z 0\ 0@ 0 0| 0` 0H 0 0 0 0ptL@@Ѓ 0 0 0 0Ѓ 0a 0 0JJJ$% 0JJJ$%( 0`P@ 0|LX 0 0p 0|L 0~0 0 0@L 0|LЄ 0c0 0@L 0`:MJ 0AM 0AMJ0 0 MH 0|L` 00 0AMx 0|L 0`0, 0F 0@L 00؅ 0@L 0J AD 0 AMJ 0J |L8 0D 0P 0@Lh 0|L 0P 0@L 0`:MJ 0p{L`Ȇ 0 0C 0 0!% 0 0 0% 0 0!C 0 0 0% 0 0!% 0 0( 0% 0 0!% 0 0@ 0P!{(0(X 0(0@ 0̀ 0p 0 0 0 0` 0 0(0Ї 0(@ 0hh 0(@ 088 0(@ 0 0 0P 0` t 0d 0X 0hhptL 0 0 0!$%J1`zL|L@ 00( 0F@L|L04 0 0@L`:MJ\D% 0 0 0% 0 0!@P!{(0(d 0(0@ 0 0 0@ 0 0 0 00 0 0 0@ 0 0@|(0 0 0U0 0@ 0 0 0 0 0 0 0 0` 0P 0@ 00 0H4zh 0 088Љ 0 0pL 0 0H 0BK) 0 0 0 0P5z 0 00>`̊ 0 0hhp 0XzL|L8 00LB 0(@ 0 0L 0 0` 00@l 0 0(@ 0؏ 0 0\` 0(@ 0Ї 00x8;@ 0(x؏ 0 8@q80x88 80 00 0 H 0, 0@ 040x 080x 0h 0q 0 0 0T 0 0P6L 0 0 0, 0 080x88 8`< 00x88 800q80x 0 80p 0q 0 0 0 0p 0hU 0 0 0X 0L 0 0 0(0x 0 0Ѝ 0H 0P 3Ѝ 0 0V 088  0``w/88 0 xH`w2H 0V 088 A``w/p 088 z0.P 03V 0hh 0 0 0 0@, 0 0 0` 0L 00(0E 0 0!Pj@configc8 0nt0P 010Ȋ 0` 0 0D 0W 0hh 0HL 0 0_ 0(0 0(@ 088 0P    ^F  "         __`bh UU5IOZ==~1=~1Lv% @MiM       > > w w w w    &n&n&n0000"U[y[y[y[y[yjJjJgg'? \Hv8v8v8v8v8@#,#,#,#,\ @P@P$ ]!M#A%zz&^KK*Г3,B.B.B.B.$034C"6j89i< DR>DhF?DhF?DhF?}:@"B(C(C F F FEGEGEGEG~H~H~H~HI@J)?K)?KbcLbcLbcLMMM |O |O |OFpPeQ{T<{T<{T<{T<{T<MMFA !,7BMXcny)4?JU`kv&1<GR]hs~ #.9D@@bbbbbP4aa ;1 ;_>:_>:_>:,fB @!,7BMXcny)4?JU`kv&1<GR]hs~ #.9DOZep{  +6ALWbmx(3>IT_ju%0;FQ\gr} "-8CNYdoz *5@KValw   ' 2 = H S ^ i t     $ / : E P [ f q | @ ! , 7 B M X c n y           `@ K __`bh UU5IOZ==~1=~1Lv% iMiM       > > w w w w    @&n&n&n0000"U[y[y[y[y[yjJjJgg'? \Hv8v8v8v8v8#,#,#,#,\ @P@P$ ]!M#A%zz&^KK*Г3,B.B.@B.B.$034C"6j89i< DR>DhF?DhF?DhF?}:@"B(C(C F F FEGEGEGEG~H~H~H~HIJ)?K)?KbcLbcLbcLMMM |O |O |OFpPeQ z0RNN< O^zsysdtspackagesm $!@>  $!|0RGGM^|tsysdtspackages $"bx8 $#bJ #N0*U  'P4 Nsysdtspackagesd $$b0 &*6*sysdtspackages2D $%b!; ' D@ c $(A!F@ $&bx8XXH4H! $*$$$$@0RN<O^zsysdtsckagesncsyscolum@ X(x80x8 eP 0R 0*H048Lx8(@X0 09 0@ 0RX`HNN< *O$$$$@@pk_dtspackages0RNN< @O^zsysdtspackagesx8"g@?/ k/XT0X/dl/7@?/ kx8v^bx8Tx8^bC0x8f,bTx8,0JC//x8Jx8HbC8x80wWvj0,/x8cbC/X0,0C/x80,0x8)b,0d0x8jc,0x8Cx80<7x8x8Yvx8́C,0@$x8 0*N .238x8x8ueA/$/x8 @/U 'Tx8v`x8hh9 0d009 0//x8x8hv,x80vx80vhx8uv(x8px8x8$x8@U  'Xc/P4"AllocMixedExtent/8 $)cc J08 $* cc J4 $)cP4 $)/D $( b $T/`8D $- bc $-U/pL@$. bQ 8ZPL $/ bQ $/.P, $(bQHc8 $1b $(PD $2 b $.V/`L $3 bQ $04R8 $4b $2R<Ht@x8 L < x , X , PH4T0X|$l\ / (@`venD  c !/ p L !  8ZL "  ".,  Hc8 $   D %  !"/ NU`L) L &  br $PA.'(" 5, $5b $(L 5 bO $.N lD 5 b $3R`R, x008 c $+I $"z0RNN< O^zsysdtspackage@ 5b>  50RHPR< *Q$$$$pk_dtspackages 5b>  50RHPR< *Q$$$$pk_dtspackagesnc 5b>  5@0RHPR< *Q$$$$pk_dtspackagesP 5 b TT 5 b>  5   WWPmL 5 bJ $$@ 5 b 5 b! 5bL 5 N0*!PKP4 Npk_dtspackagesd 5b *6!*pk_dtspackagesD 5b! $& !D c $'(AFOj@ 5bx8XXH@4!$*$$@0RN<O^zsysdtsckagesncsyscolum X(x80x8@ eP 0R 0*x8///,x8hx8x8x8/Ğ/Xx8fhx8x8/d0x8Ğ//x8whfd0x8g!$*$$$$$$@@UQ__sysdtspackages__1CBC46160RHPR< *Q$$$$pk_dtspackages@[00]7x8#7x8Kj0HPR *Q$$$$@x8x8$x8pk_dtspackageU  'D@5 b 5W/`D 5 bc 5X/ pL 5 bT 8ZSL 5 bT 5.S, 5bTc8 5b 5S, 5b 5P 5b>  5 $ P@5b>  5(  5b>! 50RSS!$*T$$$$$$UQ__sysdtspackages__1CBC4616 5b>! 50RSS!$*T$$@$$$$UQ__sysdtspackages__1CBC4616 5b>! 50RSS!$*T$$$$$$UQ__sysdtspackages__1CBC4616Z 5b 5 TT@4 5 bc 5DC 5!b>! 5  WWL 5"bJ 5 5#b 5$bF 5%bXj0*FUQP4 jUQ__sysdtspackages__1CBC461@u 5&bU $%F6FFUQ__sysdtspackages__1CBC4616D 5'b! 5 FD c 5(AOjDD 5# 5(bL 5+bD 5*  5,b\ 5-b>@!0Oj!D 5.b9  OjD 5/bA  Oj 50bOj 51b 5&n0*OjF P4 nFK__sysdtspac__categ__1DB06A4F 52b 5J6OjJFK__sysdtspac__categ__1DB@6A4FD 53b! 5( OjD c 5)(AP 54b9 $  t 56b\909(suser_sid(N'sa'))@n 57b/ 58b 52n0*D  P4 nDF__sysdtspac__@wner__1EA48E88 59b 53J6JDF__sysdtspac__owner__1EA48E88iD 5:b! 54 P 5; b  P 5< b 5<P 5= b 5=P 5> b H>P 5? b 5? 4 $bP4 $hx80x&(&%%8%$$ $x#X#""P" "! | 8 pP `@ T |dLH@x4H(<P Dz? .6iM.media_family_idI ` E0&iM88 5o0 6 `sP* ( ID c 55(A֌ `dnQ4,sp_make_dtspackagename Idg E0&$$E@categoryid` Id $&6&@categoryidt Id I90&@9@nameT Id I6@name_t Id I;0&88 ;@flagsvT Id I6@flagsP Id;} P I d;~ I ocP I d; I @ I d4 I d 59^0*P nQ4 ^sp_make_dtspackagenamext I d^ 5::6:sp_make_dtspackagenameD Id!A 5; He/nQ4SplitNextD I e 5@//@L Ie+\]L Ie\ 57]+L Ie]\+ Ie+ I909(suser_sid(N'sa'))^0CREATE PROCEDURE sp_get_message_description @error INT AS BEGIN IF EXISTS (SELECT * FROM master.dbo.sysmessage@ WHERE (error = @error) AND (msglangid = (SELECT msglangid FROM master.dbo.syslanguages WHERE (langid = @@langid)))) SELECT description FROM master.dbo.sysmessages WHERE (error = @error) AND (msglangid = (SELECT msglangid FROM master.dbo.syslanguages WHERE (langid = @@langid))) ELSE SELECT description FROM master.dbo.sysmessages WHERE (error = @error) AND (msglangid = 1033) END < I e\ I+\x8L Ie0  m%@+@P I e  5@4 IenQ4 I0 Id+ I0CREATE PROCEDURE sp_make_dtspackagename @categoryid UNIQUEIDENTIFIER, @name sysname OUTPUT, @flags int = 0 AS SET NOCOUNT ON @ --// If NULL catid, default to the LocalDefault category. IF (@categoryid IS NULL) SELECT @categoryid = 'B8C30002-A282-11d1-B7D9-00C04FB6EFD5' --// Validate category. We'll generate a unique name within category. DECLARE @stringfromclsi@d NVARCHAR(200) IF NOT EXISTS (SELECT * FROM sysdtscategories WHERE id = @categoryid) BEGIN SELECT @stringfromclsid = CONVERT(NVARCHAR(50), @categoryid) RAISERROR(14262, 16, 1, '@categoryid', @stringfromclsid) RETURN(1) -- Failure E@ND --// Autogenerate the next name in our format. DECLARE @max sysname, @i INT, @spidchar NVARCHAR(20) --// Any logic we use may have collisions so let's get the max and wrap if we have to. --// @@spid is necessary for guaranteed uniqueness@ but makes it ugly so for now, don't use it. --// Note: use only 9 characters as it makes the pattern match easier without overflowing. SELECT @i = 0, @spidchar = '_' -- + LTRIM(STR(@@spid)) + '_' SELECT @max = MAX(name) FROM s@ysdtspackages WHERE name like 'DTS_' + @spidchar + '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]' IF @max IS NOT NULL SELECT @i = CONVERT(INT, SUBSTRING(@max, (DATALENGTH(N'DTS_' + @spidchar) / 2) + 1, 9)) --// Wrap if needed. Find a ga@p in the names. IF @i < 999999999 BEGIN SELECT @i = @i + 1 END ELSE BEGIN SELECT @i = 1 DECLARE @existingname sysname DECLARE hC CURSOR LOCAL FOR SELECT name FROM sysdtspackages WHERE categoryid = @categoryid ORDER BY name FOR @READ ONLY OPEN hC FETCH NEXT FROM hC INTO @existingname WHILE @@FETCH_STATUS = 0 AND @i < 999999999 BEGIN SELECT @name = 'DTS_' + @spidchar + REPLICATE('0', 9 - DATALENGTH(LTRIM(STR(@i)))) + LTRIM(STR(@i)) IF @existingname@ > @name BREAK SELECT @i = @i + 1 FETCH NEXT FROM hC INTO @existingname END CLOSE hC DEALLOCATE hC END --// Set the name. SELECT @name = 'DTS_' + @spidchar + REPLICATE('0', 9 - DATALENGTH(LTRIM(STR(@i)))) + @LTRIM(STR(@i)) IF (@flags & 1) <> 0 SELECT @name P I d  IP I d IP I d I P I d I4 IdnQ4 ÍC0hx h  HdH<|,d<\ 0RiMH13"?288 00PK__backupmediafamil__09A971A2   0RiMH13"?288 00PK__backupmedias!X0 Y@fQ4 grrevL Yf1$  P Y f  I 4 YfQ4 Yd0^0X% TT     WWiM sP' ZD c I(A֌ 3!XgR4"sp_add_dtspackaget Zg I90&֌ 9@nameuT Zg I6֌ @namep Zg Z50&֌ $$5@idP Zg@ Z6֌ @id| Zg  ZC0&֌ $$C@versionid\ Zg Z$6֌ $@versionid Zg  ZG0&֌ G@description` Z g Z(6֌ (@description Z@g  Z E0&֌ $$E@categoryid ` Z g Z &6֌ &@categoryid9t Z g  Z ;0&֌ ;@ownerT Z g Z 6֌ @owner Zg  Z G0&֌ ""@G@packagedata` Zg Z(6֌ (@packagedataP Zg; I ֌ P Zg; Z֌  P Zg; Z֌ 5 P Zg; Z֌ ' P Zg; Z֌ @ s T Zg; Zn p.֌ T Zg; ZES' ֌ P Zg; Z֌ tsP Zg; Z֌ beT Zg; Z p.֌ P Zg; Z֌ 04P @g; Z֌  wP Zg; Z֌  aT Zg; Zspro֌   Zg֌ 4 Zg  I T0*֌ P R4 Tsp_add_dtspackageh Z g' I06֌ 0sp_add_dtspackage@D Z!g!C I ֌ Hh/R4SplitNextD Z# h I0/ a@ndL Z$h,]^L Z%h] I^n, L Z&h^]a,ih  D H T  ` l|Ht<|(\H 1 /*SELECT basebit on all columns */ when 195 then 8 /*INSERT basebit */ when 196 then 16 /*DELETE basebit */ when 197 then 2 /*UPDATE basebit on all columns */ end) OG<i i  x8Li0T |Z P2'( b8 Z'h, Z%0$ CREATE PROCEDURE sp_sem_get_perf_counter_help @counter_name VARCHAR(200), @nt_langid NVARCHAR(10) = N'009' AS BEGIN DECLARE @help_id INT DECLARE @row_id INT DECLARE @counter_id INT DECLARE @reg_key NVARCHAR(200) SET NOCOUNT ON SELECT @reg_key = N'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\' + @nt_langid -- Check that the desired key exists CREATE T@BLE #result(key_exists INT) INSERT INTO #result EXECUTE master.dbo.xp_regread N'HKEY_LOCAL_MACHINE', @reg_key IF (NOT EXISTS (SELECT * FROM #result WHERE key_exists = 1)) RETURN(1) -- Failure CREATE TABLE #help ( item NVARCHAR(30), help NVARCHAR(1024) ) CREATE TABLE #counters ( item NVARCHAR(30), counter NVARCHAR(1024) ) -- Populate temporary tables INSERT INTO #help EXECUTE @aster.dbo.xp_regread N'HKEY_LOCAL_MACHINE', @reg_key, N'Help' INSERT INTO #counters EXECUTE master.dbo.xp_regread N'HKEY_LOCAL_MACHINE', @reg_key, N'Counter' -- Find the row id of the counter SELECT @row_id = CONVERT(INT, SUBSTRING(item, PATINDEX('%#%', item) + 1, 5)) FROM #counters WHERE (counter = @counter_name) IF (@row_id IS NOT NULL) AND (@row_id @ 0) BEGIN -- From the row id of the counter, backup to get the counter id SELECT @row_id = @row_id - 1 SELECT @counter_id = CONVERT(INT, counter) FROM #counters WHERE (item LIKE '%#' + CONVERT(VARCHAR, @row_id)) IF (@counter_id IS NOT NULL) AND (@counter_id > 0) BEGIN SELECT @help_id = @counter_id + 1 -- Find the row id of the help SELECT @row_id = CONVERT(INT, SUBSTRING(item, PATINDEX('%#%', item) + 1, 5)) FROM #help WHERE (h@lp = @help_id) IF (@row_id IS NOT NULL) AND (@row_id > 0) BEGIN -- Finally, lookup the help by row id SELECT @row_id = @row_id + 1 SELECT help FROM #help WHERE (item LIKE '%#' + CONVERT(VARCHAR, @row_id)) RETURN(0) -- Success END END END END < b h] Z&, x8L bh0 I$ ,P b h  @4 Z#hR4 Z#0Hi/R4SplitNextD b i Z$1/9@1L bi-0],L bi] b,-L b i, b]-L b i0 b@֌ -P b i  b4 biR4 b0 Z"g- b0֌ CREATE PROCEDURE sp_add_dtspackage @name sysname, @id UNIQUEIDENTIFIER, @versionid UNIQUEIDENTIFIER, @description NVARCHAR(255),@ @categoryid UNIQUEIDENTIFIER, @owner sysname, @packagedata IMAGE AS SET NOCOUNT ON --// If NULL catid, default to the LocalDefault category. IF (@categoryid IS NULL) SELECT @categoryid = 'B8C30002-A282-11d1-B7D9-00C04FB6EFD5' @ --// Autogenerate name if it came in NULL. If it didn't, the below will validate uniqueness. IF DATALENGTH(@name) = 0 SELECT @name = NULL IF @name IS NULL BEGIN --// First see if they specified a new version based on id instead of nam@e. if @id IS NOT NULL BEGIN SELECT @name = name FROM sysdtspackages WHERE @id = id IF @name IS NOT NULL GOTO AddPackage -- OK, add with the existing name END --// Name not available, autogenera@te one. exec sp_make_dtspackagename @categoryid, @name OUTPUT GOTO AddPackage END --// Verify name unique within category. Allow a new versionid of the same name though. IF EXISTS (SELECT * FROM sysdtspackages WHERE name = @name AND c@ategoryid = @categoryid AND id <> @id) BEGIN RAISERROR (14590, -1, -1, @name) RETURN(1) -- Failure END --// Verify that the same id is not getting a different name. IF EXISTS (SELECT * FROM sysdtspackages WHERE id = @id AND name <> @@name) BEGIN DECLARE @stringfromclsid NVARCHAR(200) SELECT @stringfromclsid = CONVERT(NVARCHAR(50), @id) RAISERROR (14597, -1, -1, @stringfromclsid) RETURN(1) -- Failure END --// Verify all versions of a package go in the sam@e category. IF EXISTS (SELECT * FROM sysdtspackages WHERE id = @id AND categoryid <> @categoryid) BEGIN RAISERROR (14596, -1, -1, @name) RETURN(1) -- Failure END --// The real information is in the IMAGE; the rest is "documentary". @ --// Therefore, there is no need to verify anything. --// The REFERENCE in sysdtspackages will validate @categoryid. AddPackage: --// We will use the original owner_sid for all new versions - all must have the same owner. --// New packages w@ill get the current login's SID as owner_sid. DECLARE @owner_sid VARBINARY(85) SELECT @owner_sid = MIN(owner_sid) FROM sysdtspackages WHERE id = @id IF @@rowcount = 0 OR @owner_sid IS NULL BEGIN SELECT @owner_sid = SUSER_SID() END ELSE @BEGIN --// Only the owner of DTS Package ''%s'' or a member of the sysadmin role may create new versions of it. IF (@owner_sid <> SUSER_SID() AND (ISNULL(IS_SRVROLEMEMBER(N'sysadmin'), 0) <> 1)) BEGIN RAISERROR (14586, -1, -1, @name) @ RETURN(1) -- Failure END END --// Everything checks out, add the package or its new version. INSERT sysdtspackages ( name, id, versionid, description, categoryid, createdate, owner, packagedata@, owner_sid ) VALUES ( @name, @id, @versionid, @description, @categoryid, GETDATE(), @owner, @packagedata, @owner_sid ) RETURN 0 -- SUCCESS P b g  b P b gH bP b g b P b g b4 ZgR4 ŹC0&&8&%% h  4 \ ( P zU <6 <software_major_version "`3 ![0& 006Ye>mAX0( v@jR4 grrevL vj1% Y֌  P v j  b 4 vjR4 vd0`0X %zU $<6 <software_build_version| &`5 %A0& 449P& wD c Z(A3!lu"XkS4$sp_drop_dtspackaget wk Z90&3!9@nameT wk Z63!@namep wk w50&3!$$5@idP wk@ w63!@ids| wk wC0&3!$$C@versionid_\ wk w$63!$@versionidP wk; Z3!VP w k; w 3!P w k; w 3!@P w k; w 3! P w k; w 3!T w k; w a e3!T wk; w[ &3! wk3!4 wk  Z V0*3!P S4 Vsp_drop_dtspackageol@wkC Z!263!2sp_drop_dtspackageD wk!E Z" 3! wk, b 03!CREATE PROCEDURE sp_drop_dtspackage @name sysname, @id UNIQUEIDENTIFIER, @versionid UNIQUEIDENTIFIER AS SET NOCOUNT ON @ --// Does the specified package (uniquely) exist? Referencing by name only may not be unique. --// We do a bit of a hack here as SQL can't handle a DISTINCT clause with UNIQUEIDENTIFIER. --// @id will get the first id returned; if only name spe@cified, see if there are more. DECLARE @findid UNIQUEIDENTIFIER SELECT @findid = id FROM sysdtspackages WHERE (@name IS NOT NULL OR @id IS NOT NULL OR @versionid IS NOT NULL) AND (@name IS NULL OR @name = name) AND (@id IS NULL OR@ @id = id) AND (@versionid IS NULL or @versionid = versionid) IF @@rowcount = 0 BEGIN DECLARE @pkgnotfound NVARCHAR(200) DECLARE @dts_package_res NVARCHAR(100) SELECT @pkgnotfound = FORMATMESSAGE(14599) + ' = ''' + ISNULL(@name,@ FORMATMESSAGE(14589)) + '''; ' + FORMATMESSAGE(14588) + ' {' SELECT @pkgnotfound = @pkgnotfound + CASE WHEN @id IS NULL THEN FORMATMESSAGE(14589) ELSE CONVERT(NVARCHAR(50), @id) END + '}.{' SELECT @pkgnotfound = @pkgnotfound + CASE WHEN @version@id IS NULL THEN FORMATMESSAGE(14589) ELSE CONVERT(NVARCHAR(50), @versionid) END + '}' SELECT @dts_package_res = FORMATMESSAGE(14594) RAISERROR(14262, 16, 1, @dts_package_res, @pkgnotfound) RETURN(1) -- Failure END ELSE IF @name IS NOT NUL@L AND @id IS NULL AND @versionid IS NULL AND EXISTS (SELECT * FROM sysdtspackages WHERE name = @name AND id <> @findid) BEGIN RAISERROR(14595, -1, -1, @name) RETURN(1) -- Failure END SELECT @id = @findid --// Only the owner o@f DTS Package ''%s'' or a member of the sysadmin role may drop it or any of its versions. --// sp_add_dtspackage ensures that all versions have the same owner_sid. IF (ISNULL(IS_SRVROLEMEMBER(N'sysadmin'), 0) <> 1) BEGIN IF (NOT EXISTS (SELEC@T * FROM sysdtspackages WHERE id = @id AND owner_sid = SUSER_SID())) BEGIN SELECT @name = name FROM sysdtspackages WHERE id = @id RAISERROR (14587, -1, -1, @name) RETURN(1) -- Failure END END --// If @versionid is NUL@L, drop all versions of name, else only the @versionid version. DELETE sysdtspackages WHERE id = @id AND (@versionid IS NULL OR @versionid = versionid) RETURN 0 -- SUCCESS eP w k  vP w k wHP w k w  P w k w4 wkS4 ẃC0p hlLTd<|(\8 4 2Uoperator_id_emailedARC0&w 88 8 6Uoperator_id_netsent --0&w 88 <: X0 @lT4 grreviL l1& v3! P  l  w 4 lT4 d0\0X_server 0& 7nameT0& 00=enabled '00& Edescription(@P h  D c w(Alu"Ci#lmT46sp_reassign_dtspackageownernt m w90&lu"9@nameT m w6lu"@namep m 50&lu"$$5@id@P m 6lu"@idr m I0&lu"I@newloginnamed m *6lu"*@newloginnameeP m; wlu"P m; lu"P m; @ lu" namT m; Zlu" P m; lu"T m;  lu" mlu"4 m  wh0*lu"P T4 hsp_reassign_dtspackageowner| mh@ wD6lu"Dsp_reassign_dtspackageownerD m!G w lu"Hn/T4SplitNextD  n b2/@ L n.^L n^ Z'.L n@8.L n0 b lu".sP  n  4 nT4 0 m. 0lu"CREATE PROCEDURE sp_reassign_dtspackageowner @name sysname, @id UNIQUEIDENTIFIER, @newloginname s@ysname AS SET NOCOUNT ON --// First, is this a valid login? IF SUSER_SID(@newloginname) IS NULL BEGIN RAISERROR(14262, -1, -1, '@newloginname', @newloginname) RETURN(1) -- Failure END --// Does the specified package (unique@ly) exist? Referencing by name only may not be unique. --// We do a bit of a hack here as SQL can't handle a DISTINCT clause with UNIQUEIDENTIFIER. --// @id will get the first id returned; if only name specified, see if there are more. DECLARE @f@indid UNIQUEIDENTIFIER SELECT @findid = id FROM sysdtspackages WHERE (@name IS NOT NULL OR @id IS NOT NULL) AND (@name IS NULL OR @name = name) AND (@id IS NULL OR @id = id) IF @@rowcount = 0 BEGIN DECLARE @pkgnotfound NVA@RCHAR(200) DECLARE @dts_package_res NVARCHAR(100) SELECT @pkgnotfound = FORMATMESSAGE(14599) + ' = ''' + ISNULL(@name, FORMATMESSAGE(14589)) + '''; ' + FORMATMESSAGE(14588) + ' {' SELECT @pkgnotfound = @pkgnotfound + CASE WHEN @id IS NULL TH@EN FORMATMESSAGE(14589) ELSE CONVERT(NVARCHAR(50), @id) END + '}.{' SELECT @pkgnotfound = @pkgnotfound + FORMATMESSAGE(14589) + '}' SELECT @dts_package_res = FORMATMESSAGE(14594) RAISERROR(14262, 16, 1, @dts_package_res, @pkgnotfound) R@ETURN(1) -- Failure END ELSE IF @name IS NOT NULL AND @id IS NULL AND EXISTS (SELECT * FROM sysdtspackages WHERE name = @name AND id <> @findid) BEGIN RAISERROR(14595, -1, -1, @name) RETURN(1) -- Failure END SELECT @id = @find@id --// Only the owner of DTS Package ''%s'' or a member of the sysadmin role may reassign its ownership. --// sp_add_dtspackage ensures that all versions have the same owner_sid. IF (ISNULL(IS_SRVROLEMEMBER(N'sysadmin'), 0) <> 1) BEGIN @IF (NOT EXISTS (SELECT * FROM sysdtspackages WHERE id = @id AND owner_sid = SUSER_SID())) BEGIN SELECT @name = name FROM sysdtspackages WHERE id = @id RAISERROR (14585, -1, -1, @name) RETURN(1) -- Failure END END --//@ Everything checks out, so reassign the owner. --// Note that @newloginname may be a sql server login rather than a network user, --// which is not quite the same as when a package is created. UPDATE sysdtspackages SET owner_sid = SUSER_SID(@@newloginname), owner = @newloginname WHERE id = @id RETURN 0 -- SUCCESS P  m  P  m P  m   P  m 4 HmT4 ́C0T\x,\@ |(8P<\87v88 PK__backupset__0C85DE4D " f' TT "   "   WW vx^X0 @o=U4 grrev L o1' lu" P  o   4 o=U4 d0`0X " ^<6Mޅ <PK__backupset__0C85DE4DD "! _  Mޅ D P$02 D c (ACi#g]$XpV4"sp_get_dtspackaget p 90&Ci#9@namezT p 6Ci#@namep p 50&Ci#$$5@idM4P p@ 6Ci#@id| p C0&Ci#$$C@versionid\ p $6Ci#$@versionidP p; Ci#P p; Ci#P p; Ci#@P p; Ci# P p; Ci# P p; Ci#P p; Ci#PP p; Ci#P pCi#4 p T0*Ci#P @V4 Tsp_get_dtspackageh pJ 06Ci#0sp_get_dtspackageD p!I  Ci#Hq/V4SplitNextD  q 3/b@L q/L q @/L q&:/ q/ 0M#CREATE PROCEDURE sp_verify_job_identifiers @name_of_name_parameter VARCHAR(60), -- Eg. '@job_name' @name_of_id_parameter VARCHAR(60), -- E@g. '@job_id' @job_name sysname OUTPUT, -- Eg. 'My Job' @job_id UNIQUEIDENTIFIER OUTPUT, @sqlagent_starting_test VARCHAR(7) = 'TEST' -- By default we DO want to test if SQLServerAgent is running (calle@r should specify 'NO_TEST' if not desired) AS BEGIN DECLARE @retval INT DECLARE @job_id_as_char VARCHAR(36) SET NOCOUNT ON -- Remove any leading/trailing spaces from parameters SELECT @name_of_name_parameter = LTRIM(RTRIM(@name@_of_name_parameter)) SELECT @name_of_id_parameter = LTRIM(RTRIM(@name_of_id_parameter)) SELECT @job_name = LTRIM(RTRIM(@job_name)) IF (@job_name = N'') SELECT @job_name = NULL IF ((@job_name IS NULL) AND (@job_id IS NULL@)) OR ((@job_name IS NOT NULL) AND (@job_id IS NOT NULL)) BEGIN RAISERROR(14294, -1, -1, @name_of_id_parameter, @name_of_name_parameter) RETURN(1) -- Failure END -- Check job id IF (@job_id IS NOT NULL) BEGIN SELECT @j@ob_name = name, @job_id = job_id FROM msdb.dbo.sysjobs_view WHERE (job_id = @job_id) IF (@job_name IS NULL) BEGIN SELECT @job_id_as_char = CONVERT(VARCHAR(36), @job_id) RAISERROR(14262, -1, -1, '@job_id', @job_@id_as_char) RETURN(1) -- Failure END END ELSE -- Check job name IF (@job_name IS NOT NULL) BEGIN -- Check if the job name is ambiguous IF ((SELECT COUNT(*) FROM msdb.dbo.sysjobs_view WHERE (name = @j@ob_name)) > 1) BEGIN RAISERROR(14293, -1, -1, @job_name, @name_of_id_parameter, @name_of_name_parameter) RETURN(1) -- Failure END -- The name is not ambiguous, so get the corresponding job_id (if the job exists) SELECT @@job_id = job_id FROM msdb.dbo.sysjobs_view WHERE (name = @job_name) IF (@job_id IS NULL) BEGIN RAISERROR(14262, -1, -1, '@job_name', @job_name) RETURN(1) -- Failure END END IF (@sqlagent_starting_test = 'TEST'@) BEGIN -- Finally, check if SQLServerAgent is in the process of starting and if so prevent the -- calling SP from running EXECUTE @retval = msdb.dbo.sp_is_sqlagent_starting IF (@retval <> 0) RETURN(1) -- Failure END R@ETURN(0) -- Success END <  q /x8L q0 M#/P  q  4 qV4 0 p q0Ci#qCREATE PROCEDURE sp_get_dtspackage @name sysname, @@id UNIQUEIDENTIFIER, @versionid UNIQUEIDENTIFIER AS SET NOCOUNT ON --// Does the specified package (uniquely) exist? Dropping by name only may not be unique. --// We do a bit of a hack here as SQL can't handle a DISTINCT clause with UNIQUE@IDENTIFIER. --// @id will get the first id returned; if only name specified, see if there are more. DECLARE @findid UNIQUEIDENTIFIER SELECT @findid = id FROM sysdtspackages WHERE (@name IS NOT NULL OR @id IS NOT NULL OR @versionid IS NOT NUL@L) AND (@name IS NULL OR @name = name) AND (@id IS NULL OR @id = id) AND (@versionid IS NULL or @versionid = versionid) IF @@rowcount = 0 BEGIN DECLARE @pkgnotfound NVARCHAR(200) DECLARE @dts_package_res NVARCHAR(100) @ SELECT @pkgnotfound = FORMATMESSAGE(14599) + ' = ''' + ISNULL(@name, FORMATMESSAGE(14589)) + '''; ' + FORMATMESSAGE(14588) + ' {' SELECT @pkgnotfound = @pkgnotfound + CASE WHEN @id IS NULL THEN FORMATMESSAGE(14589) ELSE CONVERT(NVARCHAR(50), @id) @END + '}.{' SELECT @pkgnotfound = @pkgnotfound + CASE WHEN @versionid IS NULL THEN FORMATMESSAGE(14589) ELSE CONVERT(NVARCHAR(50), @versionid) END + '}' SELECT @dts_package_res = FORMATMESSAGE(14594) RAISERROR(14262, 16, 1, @dts_package_res,@ @pkgnotfound) RETURN(1) -- Failure END ELSE IF @name IS NOT NULL AND @id IS NULL AND @versionid IS NULL AND EXISTS (SELECT * FROM sysdtspackages WHERE name = @name AND id <> @findid) BEGIN RAISERROR(14595, -1, -1, @name) RETURN@(1) -- Failure END SELECT @id = @findid --// If @versionid is NULL, select all versions of name, else only the @versionid version. --// This must return the IMAGE as the rightmost column. SELECT name, id, versionid, des@cription, createdate, owner, pkgsize = datalength(packagedata), packagedata, isowner = CASE WHEN (ISNULL(IS_SRVROLEMEMBER(N'sysadmin'), 0) = 1 OR owner_sid = SUSER_SID()) THEN 1 ELSE 0 END FROM sysdtspackages WHERE id = @id @ AND (@versionid IS NULL OR @versionid = versionid) ORDER BY name, createdate DESC RETURN 0 -- SUCCESS P  p  P p P ! p !  P " pH "4 pV4 ́C000//@/.Dt8\x4@DTd<|(\[0x8 L F>/RL F  F-->ov F > F v0R"U@}%>"~$(yP# D c (AQ%PE&\t0X4&sp_enum_dtspackages| t( C0&Q%C@name_like\ t $6Q%$@name_like t) Q0&Q%Q@desc@ription_likel t 26Q%2@description_like I t* E0&Q%$$E@categoryid` t &6Q%&@categoryidt t+ ;0&Q%88 ;@flagsT t@6Q%@flagsp t, 50&Q%$$5@idP t 6Q%@idP t; Q%P t; Q%P t; Q% P t;@ Q%P t; Q%P t; Q%lP t; Q%P t; Q%P t; Q%P t; Q%@8P t; Q%@P t; Q%x tQ%4 t X0*Q%P 0X4 Xsp_enum_dtspackagesl tE 46Q%4sp_enum_dtspackagesD t!M @ Q% t 0Q%CREATE PROCEDURE sp_enum_dtspackages @name_like sysname = '%', @description_like NVARCHAR(255) = '%', @categoryid UNIQUEIDENTIFIER = NULL, @flags INT = 0, --// Bitmask: 0x01 == return image data --// 0x02 == recursive (packagenames and categorynames only) --// 0x04 == all versions (default == only most-recent-versions) @ --// 0x08 == all prior versions versions (not most-recent; requires @id) @id UNIQUEIDENTIFIER = NULL --// If non-NULL, enum versions of this package. AS IF (@flags & 0x02) <> 0 GOTO DO_RECURSE --// Just return the non-IMAGE stuff - sp_get_dtspackage will return the --// actual dtspackage info. DECLARE @latestversiondate datetime SELECT @latestversiondate = NULL IF (@flags & 0x08 = 0x08) BEGIN SELECT @latestversiondate = MAX(t.cre@tedate) FROM sysdtspackages t WHERE t.id = @id IF @latestversiondate IS NULL BEGIN DECLARE @pkgnotfound NVARCHAR(200) DECLARE @dts_package_res NVARCHAR(100) SELECT @pkgnotfound = FORMATMESSAGE(14599) + ' = ' + FORMATMESSAGE(14589) + '; ' + FORMATMESSAGE(14588) + ' {' SELECT @pkgnotfound = @pkgnotfound + CASE WHEN @id IS NULL THEN FORMATMESSAGE(14589) ELSE CONVERT(NVARCHAR(50), @id) END + '}.{' SELECT @pkgnotfound = @pkgnotfound + FORMATMESSAGE(14589) + '}' @ SELECT @dts_package_res = FORMATMESSAGE(14594) RAISERROR(14262, 16, 1, @dts_package_res, @pkgnotfound) RETURN(1) -- Failure END END SELECT p.name, p.id, p.versionid, p.description, p.createdate, p.owner, size = datalength(p.packagedata), packagedata = CASE (@flags & 0x01) WHEN 0 THEN NULL ELSE p.packagedata END, isowner = CASE WHEN (ISNULL(IS_SRVROLEMEMBER(N'sysadmin'), 0) = 1 OR owner_sid = SUSER_SID()) THEN 1 ELSE 0 END FROM sysdt@packages p WHERE (@name_like IS NULL OR p.name LIKE @name_like) AND (@description_like IS NULL OR p.description LIKE @description_like) AND (@categoryid IS NULL OR p.categoryid = @categoryid) AND (@id is NULL OR p.id = @id) -- These filter by version AND ( (@flags & 0x08 = 0x08 AND p.createdate < @latestversiondate) OR ( (@flags & 0x04 = 0x04) OR (@flags & 0x08 = 0 AND p.createdate = (SELECT MAX(t.createdate) FROM sysdtspackages t WHERE t.id = p.id)) @ ) ) ORDER BY id, createdate DESC RETURN 0 -- SUCCESS DO_RECURSE: DECLARE @packagesfound INT SELECT @packagesfound = 0 --// Starting parent category. If null, start at root. if (@categoryid IS NULL) SELECT @categoryid = '00000000-0000-0000-0000-000000000000' IF EXISTS (SELECT * FROM sysdtspackages p INNER JOIN sysdtscategories c ON p.categoryid = c.id WHERE p.categoryid = @categoryid AND (@name_like IS NULL OR p.name LIKE @name_like)@ AND (@description_like IS NULL OR p.description LIKE @description_like) ) SELECT @packagesfound = 1 IF (@packagesfound <> 0) BEGIN --// Identify the category and list its Packages. SELECT 'Level' = @@nestlevel, 'PackageName' = p.name, 'CategoryName' = c.name FROM sysdtspackages p INNER JOIN sysdtscategories c ON p.categoryid = c.id WHERE p.categoryid = @categoryid AND (@name_like IS NULL OR p.name LIKE @name_like) AND (@description_like@IS NULL OR p.description LIKE @description_like) END --// List its subcategories' packages DECLARE @childid UNIQUEIDENTIFIER DECLARE hC CURSOR LOCAL FOR SELECT id FROM sysdtscategories c WHERE parentid = @categoryid ORDER BY c.name FOR READ ONLY OPEN hC FETCH NEXT FROM hC INTO @childid WHILE @@FETCH_STATUS = 0 BEGIN EXECUTE sp_enum_dtspackages @name_like, @description_like, @childid, @flags FETCH NEXT FROM hC INTO @childid END CLOSE hC DEALLOCATE hC RETURN@X t 0Q% 0 P  t  P  t P t P ! t !4 t0X4 C HX ` `p 0@0H4\D c F(AjJ>PM4restorehistory V Kb0&jJ88 Ubrestore_history_idl V146jJ4restore_history_id V  VG0&jh s a  X0 @uvX4 grrevL u1) Q% P  u  " 4 uvX4 d0P0XH/M4SplitNextD V  F/Ser@erAL V  P" D c (APE&9'XvWY4$sp_add_dtscategoryt v. 90&PE&9@name"T v 6PE&@name& v/ G0&PE&G@description`@v (6PE&(@descriptionp v0 50&PE&$$5@ideP v 6PE&@id2| v1 A0&PE&$$A@parentidt\ v "6PE&"@parentidP @v; PE&lP v; PE&vP v; PE&tT v; PE&P v; PE&&T v; asPE&T v; @plePE& vPE&4 v V0*PE&P WY4 Vsp_add_dtscategory_l v' 26PE&2sp_add_dtscategoryaD v!O  PE&Hw/WY4SplitNext8 w @*K0L  w \/D  w \/@8  w/ TKx8L wXL w _XeL w&BX* wX n 0A%@n CREATE PROCEDURE sp_downloaded_row_limiter @server_name NVARCHAR(30) -- Target server name AS BEGIN -- This trigger controls how many downloaded (status = 1) sysdownloadlist rows exist -- for any given server. It does NOT control the absolute number of rows in the table. DECLARE @current_rows_per_server INT DECLARE @max_rows_per_server INT -- This value comes from the resgistry (DownloadedMaxRows) DECLARE @rows_to_delete INT DECLARE @rows_to_delete_as_char VA@CHAR(10) SET NOCOUNT ON -- Remove any leading/trailing spaces from parameters SELECT @server_name = LTRIM(RTRIM(@server_name)) -- Check the server name (if it's bad we fail silently) IF (@server_name IS NULL) OR (NOT EXISTS (SELECT * FROM msdb.dbo.sysdownloadlist WHERE (target_server = @server_name))) RETURN(1) -- Failure SELECT @max_rows_per_server = 0 -- Get the max-rows-per-server from the registry EXECUTE master.dbo.xp_r@gread N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\SQLServerAgent', N'DownloadedMaxRows', @max_rows_per_server OUTPUT, N'no_output' -- Check if we are limiting sysdownloadlist rows IF (ISNULL(@max_rows_per_server, -1) = -1) RETURN -- Check that max_rows_per_server is >= 0 IF (@max_rows_per_server < -1) BEGIN -- It isn't, so default to 1@0 rows SELECT @max_rows_per_server = 100 EXECUTE master.dbo.xp_regwrite N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\SQLServerAgent', N'DownloadedMaxRows', N'REG_DWORD', @max_rows_per_server END -- Get the number of downloaded rows in sysdownloadlist for the target server in question -- NOTE: Determining this [quickly] requires a [n@n-clustered] index on target_server SELECT @current_rows_per_server = COUNT(*) FROM msdb.dbo.sysdownloadlist WHERE (target_server = @server_name) AND (status = 1) -- Delete the oldest downloaded row(s) for the target server in question if the new row has -- pushed us over the per-server row limit SELECT @rows_to_delete = @current_rows_per_server - @max_rows_per_server SELECT @rows_to_delete_as_char = CONVERT(VARCHAR, @rows_to_delete) IF (@rows_to_delete > 0) BEGIN E@ECUTE ('DECLARE @new_oldest_id INT SET NOCOUNT ON SET ROWCOUNT ' + @rows_to_delete_as_char + 'SELECT @new_oldest_id = instance_id FROM msdb.dbo.sysdownloadlist WHERE (target_server = N''' + @server_name + ''')' + ' AND (status = 1) ORDER BY instance_id SET ROWCOUNT 0 DELETE FROM msdb.dbo.sysdownloadlist WHERE (target_server = N''' + @server_name + ''')' + H ' AND (instance_id <= @new_oldest_id) AND (status = 1)') END END <  w Xr x8L w0 A%XaP w  4 wWY4 0<d p $ \LP08D\|(\@server_name6^KK*(@description Xo0eR$ P   vX  0PE& CREATE PROCEDURE sp_add_dtscategory @name sysname, @description NVARCHAR(1024), @id UNIQUEIDENTIFIER, @parentid UNIQUEIDENTIFIER AS SET NOCOUNT ON --// If parentid is NULL, use 'Local' @ IF @parentid IS NULL SELECT @parentid = 'B8C30000-A282-11d1-B7D9-00C04FB6EFD5' --// First do some simple validation of "non-assert" cases. UI should validate others and the table --// definitions will act as an "assert", but we check here @(with a nice message) for user-error stuff --// it would be hard for UI to validate. IF NOT EXISTS (SELECT * FROM sysdtscategories WHERE id = @parentid) BEGIN DECLARE @stringfromclsid NVARCHAR(200) SELECT @stringfromclsid = CONVERT(NVARC@HAR(50), @parentid) RAISERROR(14262, 16, 1, '@parentid', @stringfromclsid) RETURN(1) -- Failure END IF EXISTS (SELECT * FROM sysdtscategories WHERE name = @name AND parentid = @parentid) BEGIN RAISERROR(14591, 16, -1, @name) @RETURN(1) -- Failure END --// id uniqueness is ensured by the primary key. INSERT sysdtscategories ( name, description, id, parentid ) VALUES ( @name, @description, @id, @parentid ) RETURN 0 --H SUCCESS P  v  !P  v P  v  P  v 4 vWY4 ́C0X  h  PK__restorehistory__123EB7A3P,'( D c (A9'-(\x8Z4&sp_drop_dtscategory| x7 C0&9'C@name_like/\ x $69'$@name_likep x8 50&9'$$5@id@P x 69'@id/t x9 ;0&9'88 ;@flags7Hy/8Z4SplitNext8 y L0L  y d/D  y d/@8  y$@Lx8L y` L y `P  y L y V b` y` ^.*$>B:><@ 6&$$&"&"6& ""&*&(($*$$("& (*$":>>&@*&2$(("($>$*&0((6#,name6#,.netsend_address6#,*pager_addressD6#,$pager_days6#, >saturday_pager_end_timeJ6#, Bsaturday_pager_start_time6#,:sunday_pager_end_time6#,>sunday_pager_start_time6#, <weekday_pager_end_@ime6#, @weekday_pager_start_time6\  alert_id6\ 6notification_method6\ &operator_id$6job_id6task_idte6$categoryid6$createdate6&descriptiongn6id6name6ownerLL6 "owner_sid''6&packaged@ta6"versionid6,6@is_sysadmin_member6,&@login_name6@P@lang6@P@msgnum6@P @msgtext6@P @replace6@P"@severity6@P"@with_log 6yt@lang6yt@msgnumR6@error6&@categoryid6@flags6@n@me46*@all_counters6֌ &@categoryid6֌ (@description6֌ @id6֌ @name6֌ @owner6֌ (@packagedata6֌ $@versionid6$ *@counter_name6$ $@nt_langid63!@id63!@name63!$@versionid6]!(@action_type6]!"@alert_id6]!&@error_flag6]!@job_id6]! @op_type6]!(@schedule_id6lu"@id_6lu"@namer6lu"*@newloginname6Ci#@id6Ci#@name6Ci#$@versionid6M#@job_id6M#"@job_name6M#:@name_of_id_parameterv6M#>@name_of_n@me_parameter66M#>@sqlagent_starting_test6g]$&@categoryid>6g]$$@packageid6r$@job_id>6r$*@program_nameP6Q%&@categoryid16Q%2@description_like6Q%@flags6Q%@ido6Q%$@name_like6A%(@server_name6PE&(@description6PE&@@id6PE&@nameA6PE&"@parentid6zz&@job_idg6zz&(@object_type6zz&$@operation6zz&>@specific_target_server6zz&@value69'@idJ69'$@name_like6c(*@jobs_deleted 6c(&@msx_server6%'W)0@new_server_name6%'W)(@server_name@^KK*(@description<  y` `^x8T y# V6#,`nameP  y 4 y8Z4 0^T x`W 69'@flagsP x; 9'P x;@ 9'P x; 9'P x; 9' x9'4 x X0*9'P 8Z4 Xsp_drop_dtscategoryl xD 469'4sp_drop_dtscategoryD x@!Q  9'Hz/8Z4SplitNextD  z ]/@x8L zYL !zb YL "z#jYL #z0 9'YP $ z@  4 z8Z4 0 xY ! 09' CREATE PROCEDURE sp_drop_dtscategory @name_like sysname, @id UNIQUEIDENTIFIER = NULL, @flags INT = 0 --// Bitmask: 0x01 == recursive (drop all subcategories and packages) AS SET NOCOUNT ON --// Temp table in case recursion is needed. CREATE TABLE #recurse(id UNIQUEIDENTIFIER, passcount INT @EFAULT(0)) IF (@name_like IS NOT NULL) BEGIN INSERT #recurse (id) SELECT id FROM sysdtscategories WHERE name LIKE @name_like IF @@rowcount = 0 BEGIN RAISERROR(14262, 16, 1, '@name_like', @name_like) RETURN(1) -- Failure END IF @@rowcount > 1 BEGIN RAISERROR(14592, 16, -1, @name_like) RETURN(1) -- Failure END SELECT @name_like = name, @id = id FROM sysdtscategories WHERE name LIKE @name_like END ELSE BEGIN --// Verify the id@ @name_like will be NULL if we're here so no need to initialize. SELECT @name_like = name FROM sysdtscategories WHERE id = @id IF @name_like IS NULL BEGIN DECLARE @stringfromclsid NVARCHAR(200) SELECT @stringfromclsid = CONVERT(NVARCHAR(50), @id) RAISERROR(14262, 16, 1, '@id', @stringfromclsid) RETURN(1) -- Failure END INSERT #recurse (id) VALUES (@id) END --// We now have a unique category. --// Cannot drop the predefined categories (or th@ root, which already failed above as IID_NULL --// is not an id in sysdtscategories). These will be at top level. IF @id IN ( 'B8C30000-A282-11d1-B7D9-00C04FB6EFD5' , 'B8C30001-A282-11d1-B7D9-00C04FB6EFD5' , 'B8C30002-A282-11d1-B7D9-00C04FB6EFD5' ) BEGIN RAISERROR(14598, 16, 1) RETURN(1) -- Failure END --// Check for subcategories or packages. IF EXISTS (SELECT * FROM sysdtspackages WHERE categoryid = @id) OR EXISTS (SELECT * FROM sysdtscatego@ies WHERE parentid = @id) BEGIN --// It does. Make sure recursion was requested. IF (@flags & 0x01 = 0) BEGIN RAISERROR(14593, 16, -1, @name_like) RETURN(1) -- Failure END --// Fill up #recurse. UPDATE #recurse SET passcount = 0 WHILE (1 = 1) BEGIN UPDATE #recurse SET passcount = passcount + 1 INSERT #recurse (id, passcount) SELECT c.id, 0 FROM sysdtscategories c INNER JOIN #recurse r ON c.parentid = r.id WHERE pass@ount = 1 IF @@rowcount = 0 BREAK END END DELETE sysdtspackages FROM sysdtspackages INNER JOIN #recurse ON sysdtspackages.categoryid = #recurse.id DELETE sysdtscategories FROM sysdtscategories INNER JOIN #recurse ON sysdtscategories.id = #recurse.id RETURN(0) -- SUCCESS P ' x  %P ( x (P ) x H P * x *4 x8Z4 ́C0t&$&%%4%p<Tx00<d(@X D P4\ t=/ (n`tifD { c {>/0_idp= @L { :jJ 8Z9L { :jJ {.)cre.D 6a@aat$ X( @{uZ4 Ghost8  F4  {c `h4 {Z4 //X { ( jJR( { > { 0RjJ99  :88 88 restoreXt @|uZ4 Ghost8 > 5"8 > 8 > 4  |c B`h4 |Z4 //4X :88 88 restorehistorybackuP%!" D c (A-(")`}[4*sp_modify_dtscategoryp }: 50&-($$5@idP }`Z 6-(@idJt }; 90&-(9@nameT @`[ 6-(@name  }< G0&-(G@description` }`Z (6-((@description| }= A0&-($$A@parentidION\ }`] "6-("@parentidP@ }; -(P }; -(rP }; -(8T }; ry_i-(P }; -(iT }; -(T };@ ` -( }-(4 } \0*-(P [4 \sp_modify_dtscategoryp }f 86-(8sp_modify_dtscategoryD }!S  -(H~/[4SplitNextD  ~@ ^/@L ~ZL ~ #ZL ~Z/X ~Z N0%'W)NCREATE PROCEDURE sp_generate_target_server_job_assignment_sql @server_name NVARCHAR(30) = '(local)', @new_server_name NVARCHAR(30) = NULL -- Use this@if the target server computer has been renamed AS BEGIN SET NOCOUNT ON -- Verify the server name IF (UPPER(@server_name) <> '(LOCAL)') AND (NOT EXISTS (SELECT * FROM msdb.dbo.systargetservers WHERE (server_name = @server_name))) BEGIN RAISERROR(14262, 16, 1, '@server_name', @server_name) RETURN(1) -- Failure END IF (EXISTS (SELECT * FROM msdb.dbo.sysjobservers sjs, msdb.dbo.systargetservers@sts WHERE (sjs.server_id = sts.server_id) AND (sts.server_name = @server_name))) BEGIN -- Generate the SQL SELECT 'Execute this SQL to re-assign jobs to the target server' = 'EXECUTE msdb.dbo.sp_add_jobserver @job_id = ''' + CONVERT(VARCHAR(36), sjs.job_id) + ''', @server_name = ''' + ISNULL(@new_server_name, sts.server_name) + '''' FROM msdb.dbo.sysjobservers sjs, msdb.dbo.systargetservers sts WHERE (sjs.server_@d = sts.server_id) AND (sts.server_name = @server_name) END ELSE RAISERROR(14548, 10, 1, @server_name) RETURN(0) -- Success END _0^KK*CREATE PROCEDURE sp_generate_server_description @description NVARCHAR(100) = NULL OUTPUT, @result_set BIT = 0 AS BEGIN SET NOCOUNT ON CREATE TABLE #xp_results ( id INT NOT NULL, name NVARCHAR(30) NOT NULL, internal_value INT NULL, character_value NVARCHA@(212) NULL ) INSERT INTO #xp_results EXECUTE master.dbo.xp_msver UPDATE #xp_results SET character_value = FORMATMESSAGE(14205) WHERE (character_value IS NULL) SELECT @description = (SELECT character_value FROM #xp_results WHERE (id = 1)) + N' ' + (SELECT character_value FROM #xp_results WHERE (id = 2)) + N' / Windows ' + (SELECT character_value FROM #xp_results WHERE (id = 15)) + N' / ' + (SELECT character_v@lue FROM #xp_results WHERE (id = 16)) + N' ' + (SELECT CASE character_value WHEN N'PROCESSOR_INTEL_386' THEN N'386' WHEN N'PROCESSOR_INTEL_486' THEN N'486' WHEN N'PROCESSOR_INTEL_PENTIUM' THEN N'Pentium' WHEN N'PROCESSOR_MIPS_R4000' THEN N'MIPS' WHEN N'PROCESSOR_ALPHA_21064' THEN N'Alpha' @ ELSE character_value END FROM #xp_results WHERE (id = 18)) + N' CPU(s) / ' + (SELECT CONVERT(NVARCHAR, internal_value) FROM #xp_results WHERE (id = 19)) + N' MB RAM.' DROP TABLE #xp_results IF (@result_set = 1) SELECT @description END <  ~ Z x8L ~0 $%'W)ZP  @  +4 ~[4 0` } % 0-(% CREATE PROCEDURE sp_modify_dtscategory @id UNIQUEIDENTIFIER, @name sysname, @description NVARCHAR(1024), @parentid UNIQUEIDENTIFIER AS SET NOCOU@NT ON --// Validate. DECLARE @stringfromclsid NVARCHAR(200) IF NOT EXISTS (SELECT * FROM sysdtscategories WHERE id = @id) BEGIN SELECT @stringfromclsid = CONVERT(NVARCHAR(50), @id) RAISERROR(14262, 16, 1, '@id', @stringfromclsid) @ RETURN(1) -- Failure END IF NOT EXISTS (SELECT * FROM sysdtscategories WHERE id = @parentid) BEGIN SELECT @stringfromclsid = CONVERT(NVARCHAR(50), @parentid) RAISERROR(14262, 16, 1, '@parentid', @stringfromclsid) RETURN(1) -- F@ailure END --// Check the name uniqueness within parent, but make sure the id is different (we may just be renaming --// without reassigning parentage). IF EXISTS (SELECT * FROM sysdtscategories WHERE name = @name AND parentid = @parentid and@ id <> @id) BEGIN RAISERROR(14591, 16, -1, @name) RETURN(1) -- Failure END UPDATE sysdtscategories SET name = @name, description = @description, parentid = @parentid WHERE id = @id RETURN(0) -- SUCCESS atP }  HP ! } !P " } "  P # } #4 }[4 ́C0! t $ t@h x,\X8@L$D|,\P &$  &$~ aRi  }P, " D c (A")4A*`[4*sp_enum_dtscategories| @ A0&")$$A@parentid\ `` "6")"@parentidURt A ;0&")88 ;@fl@agsT `` 6")@flagsP ; ")P ; ")P ; ")P  ;  ")_  ")4   \0*")P @[4 \sp_enum_dtscategoriesp  G 86")8sp_enum_dtscategoriesD  !U  ")  R0")RCREATE PROCEDURE sp_enum_dtscategories @parentid UNIQUEIDENTIFIER = NULL, @flags INT = 0 --// Bitmask: 0x01 == recursive (enum all subcategories; names only) @AS IF (@flags & 0x01) <> 0 GOTO DO_RECURSE --// Go to the root if no parentid specified IF @parentid IS NULL SELECT @parentid = '00000000-0000-0000-0000-000000000000' --// 'No results' is valid here. SELECT name, description, id FROM sysdtscategories WHERE parentid = @parentid ORDER BY name RETURN 0 DO_RECURSE: --// Identify the category. IF @@nestlevel <> 0 SELECT 'Level' = @@nestlevel, name FROM sysdtscategories WHERE id = @parentid --// List it@ subcategories DECLARE @childid UNIQUEIDENTIFIER DECLARE hC CURSOR LOCAL FOR SELECT id FROM sysdtscategories c WHERE parentid = @parentid ORDER BY c.name FOR READ ONLY OPEN hC FETCH NEXT FROM hC INTO @childid WHILE @@FETCH_STATUS = 0 BEGIN EXECUTE sp_enum_dtscategories @childid, @flags FETCH NEXT FROM hC INTO @childid END CLOSE hC DEALLOCATE hC RETURN 0 L)P    $P  H P     P   4 [4 ́C0 0 PL\8\X) OR ((notify_page_operator_id = @operator_id) AND (notify_level_page <> 0)) RETURN(0) -- Success END gP 5   &%s P.p  D c (A4A*me +TE\4sysdbmaintplansx D =0&4A*$$=plan_idJ0X `d 64A*plan_id| E A0&4A*Aplan_nameT5-\@`e "64A*"plan_name F G0&4A*==Gdate_created` `d (64A*(date_createdt G 90&4A*9ownerT  `e 64A*owner@  H  O0&4A*88 Omax_history_rowsh  `e  064A*0max_history_rows  I  Y0&4A*Yremote_history_serverdt  `i  :64A*:remote_history_server_ @J  ]0&4A*88  ]max_remote_history_rowsx `f >64A*>max_remote_history_rows K K0&4A*88 $Kuser_defined_1'd `k ,64A*,user_defined_1 @L K0&4A* Kuser_defined_2d `l ,64A* ,user_defined_2 M K0&4A*== ( Kuser_defined_3d `m ,64A* ,user_defined_3 N K0&4A*@$ 0 Kuser_defined_4d `n ,64A* ,user_defined_4D  4A* R/ `D  c S/0pL  O4A* 8ZNL  O4A* .geNMA, 4A*OcL @N4A*@ >  |0R4A*NN@"O^|sysdbmaintplans 4A*x8    P0*4A*U  !J\4 Psysdbmaintplansd !- 5',64A*,sysdbmaintplans@D "!W  4A*D c (Ame ++@ #x8XXHc_04A*Hx8@x8{x=j@S( `0x8$$@( `0n_0x8tx8 _0x8C@( `0s_0d_s_0[sysobjts]x8I`a0 x8dQwx8@x8Hx8%x x8x8`Axx8q%xx8%x 0) then 'CASCADE' else 'NONE' end as CHECK_OPTION ,'NO' as IS_UPDATABLE from sysobj4$ P: , .4A* %L  O4A* .ND  4A* ,R` 8 c 5I  |0R4A*NN@"O^|sysdbmaintpla@s4  c Bh` >! 0R4A*HUW@"Vv$$PK__sysdbmaintplans__2B0A656D >! 0R4A*HUW@"Vv$$PK__sysdbmaintplans__2B0A@56D  >!  0R4A*HUW@"Vv$$PK__sysdbmaintplans__2B0A656D  f.  TT  >!    WW4A*vx€f.L@  !4A*  4A* me +   l0*me +PK4A*O\4 lPK__sysdbmaintplans__2B0A656D   H6me +HPK__sysdbmaintplans__2B0A656DD ! # 4A*me +D @ c $(A+߭,P F  +4A*d  +0++(getdate()) + ! n0*+D 4A*O\4 nDF__sysdbmain__date___2BFE89A6nl  J6+JDF__s@sdbmain__date___2BFE89A6D !  4A*+D c (A߭,-P G  ߭,4A*  [0߭,[(isnull(nt_client(),suser_sname())) ߭, # n0*߭,@ 4A*O\4 nDF__sysdbmain__owner__2CF2ADDF  J6߭,JDF__sysdbmain__owner__2CF2ADDFD !  4A*߭,D c (A-Q.P  H  -4A*T "70@-(0) #- $% n0*-D 4A*O\4 nDF__sysdbmain__max_h__2DE6D218 % J6-JDF__sysdbmain__max_h__2DE6D218toD &!   4A*-D c !(AQ./P '@I " Q.4A*X )0Q.('') *Q. +' %n0*Q.D 4A*T\4 nDF__sysdbmain__remot__2EDAF651 R , &J6Q.JDF__sysdbmain__remot__2EDAF651D -!@ ' 4A*Q.D c ((A/>0P .J ) /4A*T 0 *0/(0) 1/ 2) ,n0*/D 4A*T\4 nDF__sysdbmain__max_r__2FCF1A8A 3 @J6/JDF__sysdbmain__max_r__2FCF1A8AD 4! . 4A*/P 5   P 6  6P 7  7P 8  8 4 T\4 Hhx80<X, h$\<d8 t 0 h x 4  4,hH| 8P Dq P  A   4 ATO4 d0J0X  T86O8@notification_methodP T; DOh resP T ;-Dy 6nX $<\4DMLe $U4A* +0@\4 jAll ad-hoc plansREDMOND\_sqlbldP $ >!  4A*4 $\4 $ ]00dT= L RIMO\ T T; Tven _deOP  %D c /(A>0b1\\4&sysdbmaintplan_jobsx %W=0&>0$$=plan_idX % 6>0plan_id t % %;0&>0$$;job_idT@% %6>0job_idD % >0 R/ `D % c %S/0pL % O>0 8ZNL %  O>0 % .N, %>0OcL % N>0$ % @" $0R>0NN$5O^sysdbmaintplan_jobs % >0x8 %+ 3X0*>0U \4 Xsysdbmaintplan_jobsl %- "46>04sysdbmaintplan_jobsD %!_ 5 >@D c %(Ab152@ %x8XXHP0>0P!x8@x8{x$*6U@S(a0x8$$$$P0x8C@(a0P0d_P0[sysobjts]x8I`a0 x8dQwx8x8Hx8%x x8x8`Axx8q%x@x8%x0N$O^sysdbmntplan_jobx8CYXCx8P00PNN$5*O$$$$@@UQ__sysdbmaintplan_j__31B762FC0R>0NN$@5O^sysdbmaintplan_jobs@l/XT0X/di/xr7B/@lx8v^bx8Tx8^b@0x8f,bTx8,0+@//x8+x8Hb@8x80>0Wvj0,/x8cbx/X0,0d/x80,0x8)b,0d0x8jc,0x8Cx80<7x8x8Yvx8́C@0>0$x88/0*X .28x8>0>0U Tx8v`x8hhhx8uv(x8p>0x8x8$x8@>0U X/\4"AllocMixedExtent8 %c M08 % c M4 %\4 %/D % >0 %l/`D % c %m@/pL % i>0 8ZhL % i>0 %.othp_, %>0iPc8 %>0 %h D % >0 %n/N(@`etvL % i>0 %4j8 %>0 %jLX PHTp$HP0\@NO4 grrevL N1 > @ P  N   4 NO4 d0]0X BEGIN DECLARE @message_id_as_char VARCHAR(10) SELECT @message_id_as_char = CONVERT(VARCHAR(10), @message_id) INSERT INTO #TempRetVal EXECUTE ('IF (' + @message_id_as_cf,,0> P"`  2, % >0 %L 2 O>0 % .ND 2 >0 %R` 8 c %I" % 0R>0NN$5O^sysdbmaintpla@_jobs 2># 20R>0Phj$5*i$$$$UQ__sysdbmaintplan_j__31B762FC4 2># 20R>0Phj$5*i$$$$UQ__sysdbmaintplan_j_@31B762FC 2># 20R>0Phj$5*i$$$$UQ__sysdbmaintplan_j__31B762FC 2 f/  TT 2 ># 2   WW>0t@܀f/L 2 + %>0 2 >0 2 b1 2- 2 n0*b1UQ>0\4 nUQ__sysdbmaintplan_j__31B762FCna 2W %J6b1JUQ__sysdbmaintplan_j__31B762FCorD 2!@% >0b1D c %(A52n3D 2g 24A*L 2 2!)4A* 24A*\ 2> 5.!052>04A*!_naD 29 5/ >052D 2A 5@ 4A*52 252 2/ 2n0*52F >0\4 nFK__sysdbmain__plan___32AB8735 2 4J652JFK__sysdbmain__plan___32AB8735 D 2! 2 >052P 2  9P H  2P 2  2P 2  2 4 %\4 % H d 8  4  d Xp$ P Dn FROM msdb.dbo.sysalerts WHERE (id = @alert_id) -- Do the Delete DELETE FROM msdb.dbo.sysnotifications WHERE (alert_id = @alert_id) 20 _nPX 9D c 2(An3ϓ4d&]40sysdbmaintplan_databasesx 9  %=0&n3$$=plan_idTE X 9$ %6n3plan_id 9  9I0&n3Idatab@ase_named 9$ 9*6n3*database_nameCD 9 n3 2R/ `D 9 c 9S/0pL 9 On3 8ZNL 9  On3 9 .CN, 9n3OcL 9 Nn3@ 9 >$ 2 0Rn3NN'O^sysdbmaintplan_databases 9 n3x8 91 2b0*n3U &]4 bsysdbmaintplan_databasesx 9- 2>6n3>sysdbmaintplan_data@asesD 9!c 2 n3D c 9(Aϓ45@ 9x8XXHa0n3Px8@x8{xt@S(@`0x8$$a0x8C@(@`0a0d_a0[sysobjts]x8I``0 x8dQwx8@x8Hx8%x x8x8`Axx8q%xx8%x$ 9 0Rn3NN'O^sysdbmaintpla@_databases E>% E0Rn3Pkm'l$$UQ__sysdbmaintplan_d__3493CFA7 E>% E0Rn3Pkm'l$$UQ__sysdbmaintp@an_d__3493CFA7  E>% E0Rn3Pkm'l$$UQ__sysdbmaintplan_d__3493CFA7 E f0 2 TT E >% E   WW@n3UPI܀enuf0L E 1 9ullblen3 E n3 E ϓ4 E3 E n0*ϓ4UQn30]4 nUQ__sysdbmaintplan_d__3493CFA7RS EX 9J6ϓ4JUQ__sysdbmaintplan_d__3493CFA7 D E@ 9 n3ϓ4D c 9(A5|6D Eg E4A*\ E> 2!05n34A*!ERED E9 2 n35D EA 2 4A*5 E5 E5 @n0*5F n30]4 nFK__sysdbmain__plan___3587F3E0ot E 2J65JFK__sysdbmain__plan___3587F3E0e)D E! E n35P E  2!P E  EP E H EP E  E4 90]4 9hx80 8 H  t 0 p,d|0$ P DSplitNextD m   m./@ L m!*0)'L m") m'*L E!lnPr:< LD c E(A|6R& E 0R|6NN)EO^sysdbmaintplan_history L"@|6x8 L#7 E^0*|6U  "v]4 ^sysdbmaintplan_historyt L$. E:6|6:sysdbmaintplan_historyD L%!g E |6D c L(AR& L"$ |6 P L0>@& L0( |6 L1>' L10R|6nn o88 UQ__sysdbmaintplan_h__37703C52 L2>' L20R|6nn o88 U@__sysdbmaintplan_h__37703C52 L3>' L30R|6nn o88 UQ__sysdbmaintplan_h__37703C52 L4f1 E TT L5>' L4@  WW|6܀f1L L67 L$ "$|6 L7|6 L8Rge0`d8e('00000000-0000-0000-0000-000000000000')T h L?`d8 L@; L:n0*`d8D |6v]4 @nDF__sysdbmain__plan___3864608B4 LA EJ6`d8JDF__sysdbmain__plan___3864608BfD LB! L< |6`d8D c L=(AĄX9L:P LC L> ĄX9|6x LE=0ĄX9=('All ad-h@oc plans') LFĄX9 LG= LAn0*ĄX9D |6v]4 nDF__sysdbmain__plan___395884C4 s LH LBJ6ĄX9JDF__sysdbmain__plan___395884C4D LI! LC |6ĄX9D c LD(AL:6@;P LJ@ LE L:|6l LL'10L:1(@@servername)t_ LML: LN? LHn0*L:D |6v]4 nDF__sysdbmain__serve__3A4CA8FD-- LO LIJ6L:JDF__sysdbmain__serve__3A4CA8FDULD L@! LJ |6L:D c LK(A6@;o4<P LQ LL 6@;|6T LS LM06@;(1) LT6@; LUA LOn0*6@;D |6v]4 nDF__sysdbmain__succe__3B40CD36 LV@ LPJ66@;JDF__sysdbmain__succe__3B40CD36D LW! LQ |66@;D c LR(Ao4<)=P LX LS o4<|6d LZ +0o4<+(getdate()) L[o4< L\C LVn@*o4P L_ LZ )=|6 T La L[@0)=(0) Lb)= LcE L]n0*)=D  |6v]4 nDF__sysdbmain__durat__3D2915A8 Ld L^J6)=JDF__sysdbmain__durat__3D2915A8 D Le! L_ |6)=D c L`(A9>^?P L@! La 9>|6 T Lh Lb09>(0) Li9> LjG Ldn0*9>D  |6v]4 nDF__sysdbmain__error__3E1D39E1 Lk LeJ69>JDF__sysdbmain__error__3E1D39E1D Ll!@ Lf |69>P Lm  E P Ln  LnP Lo   LoP Lp  Lp 4 Lv]4 Lhx80h998x8(87`766D655l54@4 43|3832p211D100l0/@/ /.|.8.-p-,,<,++d+*8**)P) )(D('H'&&H&&%$$$L$#@#<"8!4 h0l(` , h   @ `8d8Px H\ DL_/P4SpaceAllocD  _ J/ e`oL  _J|f0P2QZ LmP < j@0{]4 clust j|6@ jx8XXH|6@[`0x8"x8H$$88 x& L60R|6NN)EO^sysdbmaintpla@_history t>' t0R|6@pr)K"q$$88 clustP t Lh Y|6P t t |6P t  t  T|6P t  t@ eP|6P t " t  4|6  t >' t0R|6@pr)K"q$$88 clust t >' t 0R|6@pr)K"q$$88 @clust tf2 L5TT t>' t  WW|6f2L t o|6 L,.n7cD t |6 tr` 8 c tM( t0R|6nn o܀88 UQ__sysdbmaintplan_h__37703C52f1 tf1 tTTP t>' t(@ |6P t>' t$ |6@ tx8XXH|6 x8/hx8 &/VV88 /x8hx8"gx8x8/d0(7dDx8hx8x8 0 //x8/D/@0x8' t$ |6P t!>' t!( |6 t">( t"0R|6ss &t88 $$88 UQ__sysdbmaintplan_@__37703C52d t#>( t#0R|6ss &t88 $$88 UQ__sysdbmaintplan_h__37703C52bu t$>( t$0R|6ss &t88 $$88@UQ__sysdbmaintplan_h__37703C52 t%f1 tTT t&>( t%  WW|6f1L t'7 Lk""#"|6 t(|6D7 t(H t)|6P t+  LqP t,  t,P t-  t- 4 j]4 j! | , \P4\04l  @ ,l Dt$4P D$3idL $b ht(Lp nP6XEF" D c Lg(A^?S@dW^4.sp_delete_backuphistoryq 9 t G0&^?==G@oldest_date` R L(6^?(@oldest_dateP * ^? P @* ^? P , ^?jJ$P - ^?'P . ^?' eP  ,  ^?jJaP  0  ^?HP  1  @^?H tP  ,  ^?jJT  .   ^?jJP , ^?&nP - ^?&n P + ^? \P * ^? @_T +  /^? P * ^?iMP + ^?iM P * ^?P + ^?  ^?4H/W^4SplitNext@D   tR/ `L  SL NL N*L  t*NL  Nz N 'bnhXhndnfblnVnP^VnVnRn^nZn^nXnVnVVRXTZh0*{/@ X3 bsp_add_targetservergroup0*/D 4A*T\4 nDF__sysdbmain__max_r__2FCF1A8A0*$0P 93 hsp_update_targetservergroup0*>0U \4 Xsysdbmaintplan_jobs0*H0P 3 hsp_delete_targetservergroup0*b1UQ@>0\4 nUQ__sysdbmaintplan_j__31B762FC0*&m1P 3 dsp_help_targetservergroup0*52F >0\4 nFK__sysdbmain__plan___32AB87350*_2P 3 fsp_add_targetsvrgrp_member0*n3U &]4 bsysdbmaintplan_database@0*3P 3 lsp_delete_targetsvrgrp_member0*ϓ4UQn30]4 nUQ__sysdbmaintplan_d__3493CFA70*4P 3 Vsp_verify_category0*5F n30]4 nFK__sysdbmain__plan___3587F3E00* 5P 3 Psp_add_category0*|6@  #"v]4 ^sysdbmaintplan_history0*C"6P `3 Vsp_update_category0*RD  |6v]4 nDF__sysdbmain__error__3E1D39E10* DR>P 4 Vsp_verify_job_timex80*DhF?P 4 Vsp_help_jobhistory0*}:@P 4 Rsp_add_jobserverC0*.AP 4 Xsp_delete_jobserv@r0*"BP 4 Tsp_help_jobserver0*(CP h4 Zsp_help_downloadlist0*a DP D4 hsp_enum_sqlagent_subsystems<  ( N'rx8H  Y{/NP !  t.4 @W^4 0' N! `0*^?P W^4 `sp_delete_backuphistoryt $G Ll<6^?<sp_delete_backuphistoryD %!q Lm ^?H/W^4SplitNextD '  _/@L@L ([L )[,L *2[ +[ )0DhF?CREATE PROCEDURE sp_help_jobhistory @job_id UNIQUEIDENTIFIER = NULL, @job_name sysname = NULL, @step_id INT = NULL, @sql_message_id @ INT = NULL, @sql_severity INT = NULL, @start_run_date INT = NULL, -- YYYYMMDD @end_run_date INT = NULL, -- YYYYMMDD @start_run_time INT = NULL, -- HHMMSS @end_run_time INT = NULL, -- HHMMSS @minimum_run_duration INT = NULL, -- HHMMSS @run_status INT = NULL, -- SQLAGENT_EXEC_X code @minimum_retries INT @ = NULL, @oldest_first INT = 0, -- Or 1 @server NVARCHAR(30) = NULL, @mode VARCHAR(7) = 'SUMMARY' -- Or 'FULL' or 'SEM' AS BEGIN DECLARE @retval INT DECLARE @order_by INT -- Must be INT since it can be -1 SET NOCOUNT ON -- Remove any leading/trailing spaces from parameters SELECT @server = LTRIM(RTRIM(@server)) SELECT @mode = LTRIM(RTRIM(@mode)) -- Turn [nullable] empty string paramet@rs into NULLs IF (@server = N'') SELECT @server = NULL -- Check job id/name (if supplied) IF ((@job_id IS NOT NULL) OR (@job_name IS NOT NULL)) BEGIN EXECUTE @retval = sp_verify_job_identifiers '@job_name', '@job_id', @job_name OUTPUT, @job_id OUTPUT IF (@retval <> 0) RETURN(1) -- Failure END -- Check @start_run_date @ IF (@start_run_date IS NOT NULL) BEGIN EXECUTE @retval = sp_verify_job_date @start_run_date, '@start_run_date' IF (@retval <> 0) RETURN(1) -- Failure END -- Check @end_run_date IF (@end_run_date IS NOT NULL) BEGIN EXECUTE @retval = sp_verify_job_date @end_run_date, '@end_run_date' IF (@retval <> 0) RETURN(1) -- Failure END -- Check @start_run_time EXECUTE @retval = sp_verify_job_time @start_run_time, '@start_run_time' IF (@retval <> 0) @RETURN(1) -- Failure -- Check @end_run_time EXECUTE @retval = sp_verify_job_time @end_run_time, '@end_run_time' IF (@retval <> 0) RETURN(1) -- Failure -- Check @run_status IF ((@run_status < 0) OR (@run_status > 5)) BEGIN RAISERROR(13266, -1, -1, '@run_status', '0..5') RETURN(1) -- Failure END -- Check mode SELECT @mode = UPPER(@mode) IF (@mode NOT IN ('SUMMARY', 'FULL', 'SEM')) BEGIN RAISERROR(14266, -1, -1, '@mode', 'SUMMARY, FULL, SEM') RET@RN(1) -- Failure END SELECT @order_by = -1 IF (@oldest_first = 1) SELECT @order_by = 1 -- Return history information filtered by the supplied parameters. -- NOTE: SQLDMO relies on the 'FULL' format; ** DO NOT CHANGE IT ** IF (@mode = 'FULL') BEGIN SELECT sjh.instance_id, -- This is included just for ordering purposes sj.job_id, job_name = sj.name, sjh.step_id, sjh.step_name, sjh.sql_message_id, sjh.sq@_severity, sjh.message, sjh.run_status, sjh.run_date, sjh.run_time, sjh.run_duration, operator_emailed = so1.name, operator_netsent = so2.name, operator_paged = so3.name, sjh.retries_attempted, sjh.server FROM msdb.dbo.sysjobhistory sjh LEFT OUTER JOIN msdb.dbo.sysoperators so1 ON (sjh.operator_id_emailed = so1.id) LEFT OUTER JOIN msdb.dbo.sysoper@tors so2 ON (sjh.operator_id_netsent = so2.id) LEFT OUTER JOIN msdb.dbo.sysoperators so3 ON (sjh.operator_id_paged = so3.id), msdb.dbo.sysjobs_view sj WHERE (sj.job_< ,  *[x8L -0( DhF?[P .   "4 'W^4 '0 &@ -_0^?_CREATE PROCEDURE sp_delete_backuphistory @oldest_date datetime AS BEGIN declare @bsid int declare @msid int declare @rows int declare @errorflag int declare @str nvarchar(64) set nocount on set @errorflag@ = 0 declare oldbackups insensitive cursor for select backup_set_id from backupset where backup_finish_date < @oldest_date for read only open oldbackups fetch next from oldbackups into @bsid while(@@fetch_status = 0) begin beg@in transaction set rowcount 1 set @rows = (select count(*) from restorehistory where backup_set_id = @bsid) set rowcount 0 if (@rows > 0) begin delete from restorefile where restore_history_id in (select restore_history_id f@rom restorehistory where backup_set_id = @bsid) if (@@error <> 0) begin rollback transaction set @errorflag = 1 break end delete from restorefilegroup where restore_history_id in (select restore_hi@story_id from restorehistory where backup_set_id = @bsid) if (@@error <> 0) begin rollback transaction set @errorflag = 1 break end delete from restorehistory where backup_set_id = @bsid if @(@@error <> 0) begin rollback transaction set @errorflag = 1 break end end delete from backupfile where backup_set_id = @bsid if (@@error <> 0) begin rollback transaction se@t @errorflag = 1 break end set @msid = (select media_set_id from backupset where backup_set_id = @bsid) delete from backupset where backup_set_id = @bsid if (@@error <> 0) begin rollback transaction set @er@rorflag = 1 break end set rowcount 1 set @rows = (select count(*) from backupset where media_set_id = @msid) set rowcount 0 if (@rows = 0) begin delete from backupmediafamily where media_set_id = @msid if@ (@@error <> 0) begin rollback transaction set @errorflag = 1 break end delete from backupmediaset where media_set_id = @msid if (@@error <> 0) begin rollback transaction @ set @errorflag = 1 break end end commit transaction fetch next from oldbackups into @bsid end deallocate oldbackups set nocount off if (@errorflag <> 0) begin set @str = (select convert( nvarchar(64),@ @bsid)) raiserror( 4325, -1, -1, @str ) return(1) end set @str = (select convert( nvarchar(64), @oldest_date)) raiserror( 4324, -1, -1, @str ) return(0) END /P 1   /P 2  2HP 3  3 P 4  44 W^4 ́C0DhDDCxC--\--,Lt0$Xt ( DHXdp 0@@\ 5<P 5= b 5=P alU e eUsPXzF ` `44 $bP4 $hx80x&(&%%8%$$ $x#X#""P" "! | 8 pP `@ T |dLH@x4H(<P Dz? .6iM.media_family_idI ` E0&iM88 5o0 6 `sX  `4 f\f0tspackagename Idg E0&$$E@categoryid` Id $&6&@categoryidt Id I90&X @u&l4 Ghost8 >  t'8 >! 8 >" 8 ># 4  c (B`h4 &l4 //l8XocP I d; I Xz ` 4P nQ4 ^sp_make_dtspackagenamext I d^ 5::6:sp_make_dtspackagenameD Id!A 5; He/nQ4SplitNextD I e 5X  *4 +L Ie]\+ Ie+ I909(suser_sid(N'sa'))^0CREATE PROCEDURE sp_get_message_description @error INT AS BEGIN IF EXISTS (SELECT * FROM master.dbo.sysmessagP$  D c (AS@@H5mswebtasksx I ?0&S@?procnameX b  6S@ procname| J C0&S@Coutputfile\ @b $6S@$outputfilex K ?0&S@hh?taskstatX d  6S@ taskstatx L =0&S@""=wparamsX  e 6S@wparams|  @M  A0&S@44Atrigflags\  e  "6S@"trigflagst  N  ;0&S@88 ;taskidT  d  6S@taskidD  S@ S/0`D  c @/ pL  nS@ 8ZOL  nS@ .O, S@ncL OS@D  S@ s/0`D  c y/pL  uS@ 8ZoL @ uS@ .o, S@ucL oS@  >% r0RS@oo 0u^rmswebtasks >& t0RS@OOn^tt@swebtasks S@x8 N# $F0*S@U 5 Fmswebtasks\ ' %"6S@"mswebtasksD !s & S@P   5P !  !P H  "4 5 D T  4  h pDh$`8hLt\"mrP L05web_idxproc S@j@ x8XXH,S@ x8x8H`Axhx8q%xxx8&x4bx4bx8x8@,0@,B00x8cx8 4@x8 c8jx8p,B0p/ ,B08x8x8pA/0x8*S/BS/`x8c/BS/8c,B0,B0dx8ШM/`r/`r/0px8ffM/`r/S@ @@web_idxproc@0RS@oo 0u^rmswebtasks@tx8px8x8@S@U D  S@ z/`D  c {/pL  wS@ 8ZvL  wS@ .v, S@@wc8 S@ v,  S@ P  >% $ S@P  >%  ( S@  >&  0RS@vv wweb_idxproc  @>&  0RS@vv wweb_idxproc4  c Bh` >& 0RS@vv wweb_idxprocp@x85:System.AdvanceMaxDbTimestampL  c <j,4 5  f3 t&TT >&   WWS@f3L N# HS@ S@DN#  S@P   #P   4 5 HD$XLtHLdP.x " D c (A@ATg5sp_insmswebtask|  A0&@A@procname\ l "6@"@procname  E0&@E@outputfi@le` l &6@&@outputfile|  A0&@hhA@taskstat\ n "6@"@taskstatx  ?0&@""?@wparamsX  o  6@ @wparams|    C0&@44C@trigflags\  o  $6@$@trigflagsx    =0&@88 =@taskidX  n  6@@taskidP n @S@@P o @S@P p @S@P q @S@P r @S@P s @S@ @ N% P0*@P @l5 Psp_insmswebtaskH/l5SplitNextX/q5"AllocMixedExtent8 c jOT08  c tO4 q5 /D   |/`L  N3@@xL x0L  xP   L   L;bx !x C>,:<2(>840:2:DH@42$84DJfH@00BBDB(.6$240,6.86@*$<@:<8((D84,JD,B:24@06[>sp_convert_jobid_to_char6~x,sp_delete_alert6c(:sp_delete_all_msx_jobs6^?<sp_delete_backuphistory6|F72sp_delete_category6c5U(sp_delete_job6n'>sp_delete_job_references6FpP8sp_delete_jobschedule6.A4sp_delete_jobserver6I0s@_delete_jobstep6t:sp_delete_notification6C}2sp_delete_operator69:sp_delete_targetserver6H0Dsp_delete_targetservergroup63Hsp_delete_targetsvrgrp_member6A%@sp_downloaded_row_limiter69'4sp_drop_dtscategory63!2sp_drop_dtspackage@-Wn$sp_droptask6")8sp_enum_dtscategories6Q%4sp_enum_dtspackages6a DDsp_enum_sqlagent_subsystems6^KK*Jsp_generate_server_description6%'W)fsp_generate_target_server_job_assignment_sql6^Hsp_get_chunked_jobstep_params6)V@sp_get_composite_@ob_info6Ci#0sp_get_dtspackage6Z0sp_get_job_alerts6eEBsp_get_jobstep_db_username6Bsp_get_message_description6)?KDsp_get_schedule_description6 '-Bsp_get_sqlagent_properties6 sy(sp_help_alert6j8.sp_help_category6(C6sp_help_downl@adlist6W$sp_help_job6DhF?2sp_help_jobhistory6eQ4sp_help_jobschedule6"B0sp_help_jobserver6J,sp_help_jobstep6L6sp_help_notification67~.sp_help_operator6/+8sp_help_operator_jobs6':6sp_help_targetserver6&m1@sp_help_targetser@ergroup6q*sp_helphistory6f{n$sp_helptask6)"<sp_is_sqlagent_starting6b@sp_jobhistory_row_limiter6:sp_make_dtspackagename6X<sp_manage_jobs_by_login6-(8sp_modify_dtscategory6Г3,(sp_msx_defect6o?+(sp_msx_enlist6YTgDsp_multi_se@ver_job_summary6zz&8sp_post_msx_operation6i<4sp_purge_jobhistory6J r,sp_purgehistory6g]$Jsp_reassign_dtspackagecategory6lu"Dsp_reassign_dtspackageowner6p,sp_reassigntask6^YBsp_remove_job_from_targets6`u;:sp_resync_targetserver6@P@sp_sem_add_message6yt4sp_sem_drop_message6$ Fsp_sem_get_perf_counter_help6e5`f0sp_set_local_time< " E xCVx8x #@6x@sp_convert_jobid_to_charP $   4 q5 @V0Cd x/ ",6@,sp_insmswebtaskD '!u   @ (0@ CREATE PROCEDURE sp_insmswebtask -- This procedure is for internal use by Web Assistant @procname nvarchar(128), @outputfile nvarchar(255), @taskstat bit, @wparams image, @trigflags smallint, @taskid int AS IN@ERT INTO dbo.mswebtasks(procname, outputfile, taskstat, wparams, trigflags, taskid) VALUES(@procname, @outputfile, @taskstat, @wparams, @trigflags, @taskid) P )   %P *  *P +  + P ,  ,4 H5 ́C0Hp H `  P  @HX`@h,\qS2rvoj6pF@P" D c (AABT5sp_updmswebtask|    A0&AA@procname\ u "6A"@procnamex   ?0&A""?@wparams@X v  6A @wparamsP ~ AS@P ~ AS@  A  N' P0*AP 5 Psp_updmswebtaskd   !,6A,sp_updmswebta@kD  !w ( A4  +0A CREATE PROCEDURE sp_updmswebtask -- This procedure is for internal use by Web Assistant @procname nvarchar(128), @wparams image AS UPDATE dbo.mswebtasks SET wparams = @wparams WHERE procname = @procname P    -P   HP    P   4 5 ́C0l|HX,\sX0 @H5 grrevL 10 S@ P     4 H5 dV030XX4 @5 grrevP 10    S@P     4 5 dV0-0XX4 @5 grrevP 10   S@P     4 5 dV00XX4 @)5 grrevP 10   S@P     4 )5 dV0!0XX0 @t5 grrevL 12 @ P     4 t5 dV0S0XX0 @5 grrevL 14 A P     4 5 dV0J0XXz ` 97X  (:7 lX ` 7D c $@xX  7 Xz ` ް7X  ް7 n8 ?44 0d@?0 0>@ 0@?P 0>` 0[@?p 0> 0N@? 0> 0M@? 0(T!{ 0 0Ѐ 0(0 0 0a@ 0> 0C@? 0> 0@@?@0 0>@ 0?@??P 0>` 0>@?@p 0> 0=@?@ 0T!{H 0 0 0Q0 0(؁ 0 0a@ 0Ё 0> 0:@?@ 0> 09@?? 0> 08@?@0 0>@ 07@?@P 0>` 06@ 0p 0!P8z 0H 0 0 0F 0Cz  0 0 0F 00@ 0@Ђ 0 02@| 0 0 08z  0 0 0 088 0P 0  00 0 0@ 0P8zP 0 00 0` 0Fp 0H;z 0\ 0@ 0 0| 0` 0H 0 0 0 0ptL@@Ѓ 0 0 0 0Ѓ 0a 0 0JJJ$% 0JJJ$%( 0`P@ 0|LX 0 0p 0|L 0~0 0 0@L 0|LЄ 0c0 0@L 0`:MJ 0AM 0AMJ0 0 MH 0|L` 00 0AMx 0|L 0`0, 0F 0@L 00؅ 0@L 0J AD 0 AMJ 0J |L8 0D 0P 0@Lh 0|L 0P 0@L 0`:MJ 0p{L`Ȇ 0 0C 0 0!% 0 0 0% 0 0!C 0 0 0% 0 0!% 0 0( 0% 0 0!% 0 0@ 0P!{(0(X 0(0@ 0̀ 0p 0 0 0 0` 0 0(0Ї 0(@ 0hh 0(@ 088 0(@ 0 0 0P 0` t 0d 0X 0hhptL 0 0 0!$%J1`zL|L@ 00( 0F@L|L04 0 0@L`:MJ\D% 0 0 0% 0 0!@P!{(0(d 0(0@ 0 0 0@ 0 0 0 00 0 0 0@ 0 0@|(0 0 0U0 0@ 0 0 0 0 0 0 0 0` 0P 0@ 00 0H4zh 0 088Љ 0 0pL 0 0H 0BK) 0 0 0 0P5z 0 00>`̊ 0 0hhp 0XzL|L8 00LB 0(@ 0 0L 0 0` 00@l 0 0(@ 0؏ 0 0\` 0(@ 0Ї 00x8;@ 0(x؏ 0 8@q80x88 80 00 0 H 0, 0@ 040x 080x 0h 0q 0 0 0T 0 0P6L 0 0 0, 0 080x88 8`< 00x88 800q80x 0 80p 0q 0 0 0 0p 0hU 0 0 0X 0L 0 0 0(0x 0 0Ѝ 0H 0P 3Ѝ 0 0V 088  0``w/88 0 xH`w2H 0V 088 A``w/p 088 z0.P 03V 0hh 0 0 0 0@, 0 0 0` 0L 00(0E 0 0!Pj@configc8 0nt0P 010Ȋ 0` 0 0D 0W 0hh 0HL 0 0_ 0(0 0(@ 088 0f+, %0C}CREATE PROCEDURE sp_delete_operator @name sysname, @reassign_to_operator sysname = NULL AS BEGIN DECLARE @id INT DECLARE @alert_fail_safe_operator sysname DECLARE @job_id UNIQUEIDENTIFIER DECLARE @job_id_as_char VARCHAR(36) DECLARE @notify_email_operator_id INT DECLARE @notify_netsend_operator_id INT DECLRE @notify_page_operator_id INT DECLARE @reassign_to_id INT DECLARE @cmd NVARCHAR(512) DECLARE @current_msx_server NVARCHAR(30) SET NOCOUNT ON -- Remove any leading/trailing spaces from parameters SELECT @name = LTRIM(RTRIM(@name)) SELECT @reassign_to_operator = LTRIM(RTRIM(@reassign_to_operator)) -- Turn [nullable] empty string parameters into NULLs IF (@reassign_to_operator = N'') SELECT @reassign_to_operator =NULL -- Only a sysadmin can do this IF (ISNULL(IS_SRVROLEMEMBER(N'sysadmin'), 0) <> 1) BEGIN RAISERROR(15003, 16, 1, N'sysadmin') RETURN(1) -- Failure END -- Check if this Operator exists IF (NOT EXISTS (SELECT * FROM msdb.dbo.sysoperators WHERE (name = @name))) BEGIN RAISERROR(14262, 16, 1, '@name', @name) RETURN(1) -- Failure END -- Check if this operator the FailSafe Operator EXECUTE master.dbo.xp_regread N'HKE_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\SQLServerAgent', N'AlertFailSafeOperator', @alert_fail_safe_operator OUTPUT, N'no_output' -- If it is, we disallow the delete operation IF (LTRIM(RTRIM(@alert_fail_safe_operator)) = @name) BEGIN RAISERROR(14504, 16, 1, @name, @name) RETURN(1) -- Failure END -- Check if this operator is 'MSXOperator IF (@name = N'MSXOperator') BEGIN DECLARE @server_type VARCHAR(3) -- Disallow the delete operation if we're an MSX or a TSX EXECUTE master.dbo.xp_regread N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSSQLServer\SQLServerAgent', N'MSXServerName', @current_msx_server OUTPUT, N'no_output' IF (@current_msx_server IS NOT NULL) SELECT @serer_type = 'TSX' IF ((SELECT COUNT(*) FROM msdb.dbo.systargetservers) > 0) SELECT @server_type = 'MSX' IF (@server_type IS NOT NULL) BEGIN RAISERROR(14223, 16, 1, 'MSXOperator', @server_type) RETURN(1) -- Failure END END -- Convert the Name to it's ID SELECT @id = id FROM msdb.dbo.sysoperators WHERE (name = @name) IF (@reassign_to_operator IS NOT NULL) BEGIN -- On a TSX or standalone server, disallow re-assigning to the MSXperator IF (@reassign_to_operator = N'MSXOperator') AND (NOT EXISTS (SELECT * FROM msdb.dbo.systargetservers)) BEGIN RAISERROR(14251, -1, -1, @reassign_to_operator) RETURN(1) -- Failure END SELECT @reassign_to_id = id FROM msdb.dbo.sysoperators WHERE (name = @reassign_to_operator) IF (@reassign_to_id IS NULL) BEGIN RAISERROR(14261, -1, -1, '@reassign_to_operator', @reassign_to_operator) RETURN(1) -- Failure END END -- Double up any single quotes in @reassign_to_operator IF (@reassign_to_operator IS NOT NULL) SELECT @reassign_to_operator = REPLACE(@reassign_to_operator, N'''', N'''''') BEGIN TRANSACTION -- Reassign (or delete) any sysnotifications rows that reference this operator IF (@reassign_to_operator IS NOT NULL) BEGIN UPDATE msdb.dbo.sysnotifications SET operator_id = @reassign_to_id WHERE (operator_id = @id) AND (NOT EXISTS (SELEC * H/?4SplitNextD  */st@arL &0%XL % X&L X%m&X & M @0x}M --Identifies user defined datatype accessible to currnt user. create view INFORMATION_SCHEMA.DOMAINS as select DB_NAME() as DOMAIN_CATALOG ,USER_NAME(typ.uid) as DOMAIN_SCHEMA ,typ.name as DOMAIN_NAME ,spt_dtp.LOCAL_TYPE_NAME as DATA_TYPE ,typ.length + spt_dtp.charbin as CHARACTER_MAXIMUM_LENGTH ,typ.prec + spt_dtp.charbin as CHARACTER_OCTET_LENGTH ,case when spt_dtp.LOCAL_TYPE_NAME in ('char', 'varchar', 'text', 'nchar', 'nvarchar', 'ntext') then 'master' else NULL end as COLLATION_CATALOG ,case wen spt_dtp.LOCAL_TYPE_NAME in ('char', 'varchar', 'text', 'nchar', 'nvarchar', 'ntext') then 'dbo' else NULL end as COLLATION_SCHEMA ,case when spt_dtp.LOCAL_TYPE_NAME in ('char', 'varchar', 'text', 'nchar', 'nvarchar', 'ntext') then b_cha.name else NULL end as COLLATION_NAME ,case when spt_dtp.LOCAL_TYPE_NAME in ('char', 'varchar', 'text', 'nchar', 'nvarchar', 'ntext') then 'master' else NULL end as CHARACTER_SET_CATALOG ,case whn spt_dtp.LOCAL_TYPE_NAME in ('char', 'varchar', 'text', 'nchar', 'nvarchar', 'ntext') then 'dbo' else NULL end as CHARACTER_SET_SCHEMA ,case when spt_dtp.LOCAL_TYPE_NAME in ('char', 'varchar', 'text', 'nchar', 'nvarchar', 'ntext') then a_cha.name else NULL end as CHARACTER_SET_NAME ,nullif(typ.xprec, 0) as NUMERIC_PRECISION ,spt_dtp.RADIX as NUMERIC_PRECISION_RADIX ,typ.scale as NUMERIC_SCALE ,spt_dtp.SQL_DATETIME_SUB as DATETIME_PRECISION ,com.text as DOMAIN_DEFAULT FROM master.dbo.spt_datatype_info spt_dtp, systypes typ LEFT OUTER JOIN syscomments com on typ.tdefault = com.id AND com.colid = 1, master.dbo.sysconfigures cfg, master.dbo.syscharsets a_cha, --charset/1001, not sortorder. master.dbo.syscharsets b_cha --sortorder/2001, not charset. WHERE typ.xtype = spt_dtp.ss_dtype AND (spt_dtp.ODBCVer is null or spt_dtp.ODBCVer = 2) -- Use 7.0 entries AND spt_dtp.AUTO_INCREMENT in ( 0, null) -- Remove autoincrement types AND cfg.comment = 'default sortorder id' AND a_cha.type = 1001 --- type is charset AND b_cha.type = 2001 -- type is sortorder AND a_cha.id = b_cha.csid AND b_cha.id = cfg.value AND typ.xusertype > 256 -- UDF Type 0 l~@ --Identifies user defined datatype accessible to current user, that have constraints create view INFORMATION_SCHEMA.DOMAIN_CONSTRAINTS as select DB_NAME() as CONSTRAINT_CATALOG ,USER_NAME(obj.uid) as CONSTRAINT_SCHEMA ,obj.name as CONSTRAINT_NAME ,DB_NAME() as DOMAIN_CATALOG ,USER_NAME(typ.uid) as DOMAIN_SCHEMA ,typ.name as DOMAIN_NAME ,'NO' as IS_DEFERRABLE ,'NO' as INITIALLY_DEFERRED FROM sysobjects obj, systypes typ WHERE obj.xtype = 'R' and obj.id = typ.domain AND typ.xusertype > 256 -- UDF Type <  % & x8L 0\x}&) P   4 ?4 0 % G 0C}G FROM msdb.dbo.sysnotifications sn2 WHERE (sn2.alert_id = msdb.dbo.sysnotifications.alert_id) AND (sn2.operator_id = @reassign_to_id))) END DELETE FROM msdb.dbo.sysnotifications WHERE (operator_id = @id) -- Update any jobs that reference this operator DECLARE jobs_referencing_this_operator CURSOR LOCAL FOR SELECT job_id, notify_email_operator_id, notify_netsend_operator_id, notify_page_operator_id FROM msdb.dbo.sysjobs WHERE (notify_email_operator_id = @id) OR (notify_netsend_operator_id = @id) OR (notify_page_operator_id = @id) OPEN jobs_referencing_this_operator FETCH NEXT FROM jobs_referencing_this_operator INTO @job_id, @notify_email_operator_id, @notify_netsend_operator_id, @notify_page_operator_id WHILE (@@fetch_status = 0) BEGIN SELECT @job_id_as_char = CONVERT(VARCHAR(36), @job_id) SELECT @cmd = N'msdb.dbo.sp_update_job @job_id = ''' + @job_id_as_char + N''', ' IF (@notify_email_operator_id = @id) IF (@reassign_to_operator IS NOT NULL) SELEC @cmd = @cmd + N'@notify_email_operator_name = N''' + @reassign_to_operator + N''', ' ELSE SELECT @cmd = @cmd + N'@notify_email_operator_name = N'''', @notify_level_email = 0, ' IF (@notify_netsend_operator_id = @id) IF (@reassign_to_operator IS NOT NULL) SELECT @cmd = @cmd + N'@notify_netsend_operator_name = N''' + @reassign_to_operator + N''', ' ELSE SELECT @cmd = @cmd + N'@notify_netsend_operator_name = N'''', @notify_level_netsend = 0 ' IF (@notify_page_operator_id = @id) IF (@reassign_to_operator IS NOT NULL) SELECT @cmd = @cmd + N'@notify_page_operator_name = N''' + @reassign_to_operator + N''', ' ELSE SELECT @cmd = @cmd + N'@notify_page_operator_name = N'''', @notify_level_page = 0, ' SELECT @cmd = SUBSTRING(@cmd, 1, (DATALENGTH(@cmd) / 2) - 2) EXECUTE (N'EXECUTE ' + @cmd) FETCH NEXT FROM jobs_referencing_this_operator INTO @job_id, @notify_email_operator_id, @notify_netsend_operator_id, @notify_page_operator_id END DEALLOCATE jobs_referencing_this_operator -- Finally, do the actual DELETE DELETE FROM msdb.dbo.sysoperators WHERE (id = @id) COMMIT TRANSACTION RETURN(@@error) -- 0 means success END RP     P    P    P   4?4 AD+*p* *)PDx,Pists IF (NOT EXISTS (SELECT * FROM msdb.dbo.sysjobs_view WHERE (job_id = @job_id))) ,T eheT Ov'Y A&p, &D c(A7~/+T@4 sp_help_operator &:K0&7~K@operator_nameOd &j,67~,@operator_name &; &G0&7~88 G@operator_id ` &j &(67~(@operator_idP & 7~#, P & &7~#,L, P & &7~#, P &  & 7~#,sysP &  & 7~#, P &  & 7~#, P &  & 7~#,me P &  & 7~#,e P & &7~#,NULP & &7~#, me P & &7~#,  P & &7~#, verP & &7~#,  P & &7~#, ob_P & &7~#,ssaP & &7~#,ritP & &7~#,ateP & &7~#,P & &7~#,P & &7~#,P & &7~sP & &7~s &7~4 &R0*7~P @4 Rsp_help_operatoh &=.67~.sp_help_operatore,D &! 7~ & & 07~CREATE PROCEDURE sp_help_operator @operator_name sysname = NULL, @operator_id INT = NULL AS BEGIN DECLARE @operator_id_as_char VARCHAR(10) SET NOCOUNT ON -- Remove any leading/trailing spaces from parameters SELECT @operator_name = LTRIM(RTRIM(@operator_name)) IF (@operator_name = '') SELECT @operator_name = NULL -- Check operator name IF (@operator_name IS NOT NULL) BEGIN IF (NOT EXISTS (SELECT * FROM msdb.dbo.sysoperators WHERE (name = @operator_name))) BEGIN RAISERROR(14262, -1, -1, '@operator_name', @operator_name) RETURN(1) -- Failure END END -- Check operator id IF (@operator_id IS NOT NULL) BEGIN IF (NOT EXISTS (SELECT * FROM msdb.dbo.sysoperators WHERE (id = @operator_id))) BEGIN SELECT @operator_id_as_char = CONVERT(VARCHAR, @operator_id) RAISERROR(14262, -1, -1, '@operator_id', @operator_id_as_char) RETURN(1) -- Failure END END SELECT so.id, so.name, so.enabled, so.email_address, so.last_email_date, so.last_email_time, so.pager_address, so.last_pager_date, so.last_pager_time, so.weekday_pager_start_time, so.weekday_pager_end_time, so.saturday_pager_start_time, so.saturday_pager_end_time, so.sunday_pager_start_time, so.sunday_pager_end_time, so.pager_days, so.netsend_address, so.last_netsend_date, so.last_netsend_time, category_name = sc.name FROM msdb.dbo.sysoperators so LEFT OUTER JOIN msdb.dbo.syscategories sc ON (so.category_id = sc.category_id) WHERE ((@operator_name IS NULL) OR (so.name = @operator_name)) AND ((@operator_id IS NULL) OR (so.id = @operator_id)) ORDER BY so.name RETURN(@@error) -- 0 means success END P &!   P &"  &"P &#  &# P &$  &$4 &@4 &́C0P l  x X  hx(8HXhx4\Psp_purgehistoryd D,,6J r,sp_purgehistoryD!- J r`A%0J r%CREATE PROCEDURE sp_purgehistory @taskname sysname = NULL, -- Was VARCHAR(100) in 6.x @taskid INT rL  5D c &(A/+h `A4*sp_help_operator_jobs_i 5D &K0&/+K@operator_namend 5t &,6/+,@operator_nameP 5 &/+#,(14P 5 5/+#,ENDP 5 5/+0s P 5 5/+0db.P 5 5/+0 illP 5  5 /+0 obsP 5  5 /+0 T @P 5  5/+0 d',P 5  5 /+0_joP 5  5 /+0 5/+ 5 &\0*/+P A4 \sp_help_operator_jobsp 5> &86/+8sp_help_operator_jobsD 5 &  /+| 5& &!C0/+CCREATE PROCEDURE sp_help_operator_jobs @operator_name sysname = NULL AS BEGIN DECLARE @operator_id INT SET NOCOUNT ON -- Check operator name SELECT @operator_id = id FROM msdb.dbo.sysoperators WHERE (name = @operator_name) IF (@operator_id IS NULL) BEGIN RAISERROR(14262, -1, -1, '@operator_name', @operator_name) RETURN(1) -- Failure END - Get the job info SELECT job_id, name, notify_level_email, notify_level_netsend, notify_level_page FROM msdb.dbo.sysjobs_view WHERE ((notify_email_operator_id = @operator_id) AND (notify_level_email <> 0)) OR ((notify_netsend_operator_id = @operator_id) AND (notify_level_netsend <> 0)) OR ((notify_page_operator_id = @operator_id) AND (notify_level_page <> 0)) RETURN(0) -- Success END gP 5   &%P   5P 5  5 P 5  54 5A4 5́C0 H ,xt$4D@\rver_insertttD ! g0s l00slCREAT5-! N ;D c 5(Ah +`B4,sp_verify_notification ;O(E0&h E@alert_nameves` ;Nf1&6h &@alert_name ;O ;K0&h K@operator_nameRd ;Ng ;,6h ,@operator_name ;O ;W0&h 00W@notification_methodmp ;Ng ;86h 8@notification_method| ;O ;A0&h 88 A@alert_id \ ; Nf ;"6h "@alert_ido. ; O  ; G0&h 88 G@operator_idA` ; Ni ; (6h (@operator_idP ; ; h v8 N'P ; ; ; h v8 P ;; ;h #, P ;; ;h #,P ;; ;h g ;h ;^0*h P B4 ^sp_verify_notificationt ;B:6h :sp_verify_notification6D ! 5 h h ;Pt5.0h .CREATE PROCEDURE sp_verify_notification @alert_name sysname, @operator_name sysname, @notification_method TINYINT, @alert_id INT OUTPUT, @operator_id INT OUTPUT AS BEGIN DECLARE @res_valid_range NVARCHAR(100) SET NOCOUNT ON SELECT @res_valid_range = FORMATMESSAGE(14208) -- Remove any leading/trailing spacs from parameters SELECT @alert_name = LTRIM(RTRIM(@alert_name)) SELECT @operator_name = LTRIM(RTRIM(@operator_name)) -- Check if the AlertName is valid SELECT @alert_id = id FROM msdb.dbo.sysalerts WHERE (name = @alert_name) IF (@alert_id IS NULL) BEGIN RAISERROR(14262, 16, 1, '@alert_name', @alert_name) RETURN(1) -- Failure END -- Check if the OperatorName is valid SELECT @operator_id = id FROM msdb.dbo.sysoperators WHERE (name = @operator_name) IF (@operator_id IS NULL) BEGIN RAISERROR(14262, 16, 1, '@operator_name', @operator_name) RETURN(1) -- Failure END -- If we're at a TSX, we disallow using operator 'MSXOperator' IF (NOT EXISTS (SELECT * FROM msdb.dbo.systargetservers)) AND (@operator_name = N'MSXOperator') BEGIN RAISERROR(14251, -1, -1, @operator_name) RETURN(1) -- Failure END -- Check if the NotificationMethod is valid IF ((@notification_method < 1) OR (@notificaton_method > 7)) BEGIN RAISERROR(14266, 16, 1, '@notification_method', @res_valid_range) RETURN(1) -- Failure END RETURN(0) -- Success END P ;   5P ;  ;P ;  ; P ;  ;4 ;B4 ;́C0D<|,<\ <\ NVARCHAR(512) DECLARE @object_name sysname DECLARE @counter_name sysname DECLARE @instance_name sysname DECLARE @pos INT SET NOCOUNT ON -- The performance condition must have the format 'object|counter|instance|comparator|value' -- NOTE: 'instance' may be empty. IF (PATINDEX(N'%_|%_|%|[><=]|[0-9]%', @performance_condition) = 0) BEGIN RAISERROR(14507, 16, 1)i e; %B  DD c ;(A+O\hC4&sp_add_notificationr) DO* ; E0&+E@alert_nameect` Dz &6+&@alert_name= DO+ DK0&+K@operator_nameEd Dz D,6+,@operator_name DO, DW0&+00W@notification_method p Dz D86+8@notification_methodP D; ;+h , 'P D ; D +\ e cP D ; D +\ speP D ; D +v8 P D ; D +v8'coT D ; D   --+\ T D; D(NO EX+\ P D; D+\ bjeP D; D+]!ame D+4 D ;X0*+P hC4 Xsp_add_notificationl D 546+4sp_add_notificationD D! ; +H/mC4SplitNextD D  +/@L D'Y[L DY ['fL D[Ye't\ D' D/Ex80v% -- Displays views accessable to current user create view INFORMATION_SCHEMA.VIEWS as select db_name() as TABLE_CATALOG ,user_name(obj.uid) as TABLE_SCHEMA ,obj.name as TABLE_NAME ,case when exists (select * from syscomments com3 where com3.id = obj.id and com3.colid > 1) then NULL else com.text end as VIEW_DEFINITION ,case when exists (select * from syscomments com2 where com2.id = obj.id and CHARINDEX('WITH CHECK OPTION', upper(com2.text)) > 0) then 'CASCADE' else 'NONE' end as CHECK_OPTION ,'NO' as IS_UPDATABLE from sysobjects obj ,syscmments com where permissions(obj.id) != 0 and obj.xtype = 'V' and obj.id = com.id and com.colid = 1 0/ -- Identifies views owned by current user and the tables used in their definition create view INFORMATION_SCHEMA.VIEW_TABLE_USAGE as select distinct db_name() as VIEW_CATALOG ,user_name(v_obj.uid) as VIEW_SCHEMA ,v_obj.name as VIEW_NAME ,db_name() as TABLE_CATALOG ,user_name(t_obj.uid) as TABLE_SCHEMA ,t_obj.name as TABLE_NAME from sysobjects t_obj ,sysobjects v_obj ,sysdepends dep where v_obj.uid = user_id() and v_obj.xtype = 'V' and dep.id = v_obj.id and dep.depid = t_obj.id 0  -- Identifies views owned by current user and the columns used in their definition create view INFORMATION_SCHEMA.VIEW_COLUMN_USAGE as select db_name() as VIEW_CATALOG ,user_name(v_obj.uid) as VIEW_SCHEMA ,v_obj.name as VIEW_NAME ,db_name() as TABLE_CATALOG ,user_name(t_obj.uid) as TABLE_SCHEMA ,t_obj.name as TABLE_NAME ,col.name as COLUMN_NAME from sysobjects t_obj ,sysobjects v_obj ,sysdepends dep ,syscolumns col where v_obj.uid = user_id() and v_obj.xtype = 'V' and dep.id = v_obj.id and dep.depid = t_obj.id and t_obj.id = col.id and dep.depnumber = col.colid i0!ECREATE DEFAULT default_sdl_error_message AS NULL< D Y D'$x8L D0  v%',P D   ;4 DmC4 D0 DY D 0+ CREATE PROCEDURE sp_add_notification @alert_name sysname, @operator_name sysname, @notification_method TINYINT -- 1 = Email, 2 = Pager, 4 = NetSend, 7 = All AS BEGIN DECLARE @alert_id INT DECLARE @operator_id INT DECLARE @notification NVARCHAR(512) DECLARE @retval INT DECLARE @old_has_notification INT DECLARE @new_has_notification INT DECLARE @res_notification NVARCHAR(100) SET NOCOUNT ON SELECT @res_notification = FORMATMESSAGE(14210) -- Remove any leading/trailing spaces from parameters SELECT @alert_name = LTRIM(RTRIM(@alert_name)) SELECT @operator_name = LTRIM(RTRIM(@operator_name)) -- Only a sysadmin can do this IF (ISNULL(IS_SRVROLEMEMBER(N'sysadmin'), 0) <> 1) BEGIN RAISERROR(15003, 16, 1, N'sysadmin') RETURN(1) -- Failure END -- Check if the Notification is valid EXECUTE @retval = msdb.dbo.sp_verify_notification @alert_name, @operator_name, @notification_method, @alert_id OUTPUT, @operator_id OUTPUT IF (@retval <> 0) RTURN(1) -- Failure -- Check if this notification already exists -- NOTE: The unique index would catch this, but testing for the problem here lets us -- control the message. IF (EXISTS (SELECT * FROM msdb.dbo.sysnotifications WHERE (alert_id = @alert_id) AND (operator_id = @operator_id))) BEGIN SELECT @notification = @alert_name + N' / ' + @operator_name + N' / ' + CONVERT(NVARCHAR, @notification_method) RAISERROR(14261, 16, 1, res_notification, @notification) RETURN(1) -- Failure END SELECT @old_has_notification = has_notification FROM msdb.dbo.sysalerts WHERE (id = @alert_id) -- Do the INSERT INSERT INTO msdb.dbo.sysnotifications (alert_id, operator_id, notification_method) VALUES (@alert_id, @operator_id, @notification_method) SELECT @retval = @@error SELECT @new_has_notification = has_notification FROM msdb.dbo.sysalerts WHRE (id = @alert_id) -- Notify SQLServerAgent of the change - if any - to has_notifications IF (@old_has_notification <> @new_has_notification) EXECUTE msdb.dbo.sp_sqlagent_notify @op_type = N'A', @alert_id = @alert_id, @action_type = N'U' RETURN(@retval) -- 0 means success END P D   DP D!  DP D"  D"  P D#  D#4 DmC4 D́C0t$\ ( DtxXdp 8\P0*xuP 84 Psp_verify_alertd3,6xu,s!E@E o (0  TD c D(AOt`ID4,sp_update_notification TO1 DE0&OE@alert_name @e` Tz  D&6O&@alert_nameme TO2 TK0&OK@operator_nameid Tz  T,6O,@operator_name TO3 TW0&O00W@notification_methodmp Tz  T86O8@notification_methodP T; DOh resP T ; TO\ ECLP T ; T O\ AR(P T ; T Ov8- RP T ; T Ov8 P T ;! T O\ IM(T T; T= L RIMO\ T T; Tven _deO\ P T;" TO]!@pe TO4 T D^0*OP ID4 ^sp_update_notificationS_t T ;:6O:sp_update_notification D T! D OH/ID4plitNext8 TiE0L T  D,/D T  T,/man@e_c8 T /iEx8L T(Y'L TY D '> ( L T' DYD (-  ( Tl0Z= --Identifies tables owned by the current user the have constraints create view INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE as select db_name() as TABLE_CATALOG ,user_name(t_obj.uid) as TABLE_SCHEMA ,t_obj.name as TABLE_NAME ,db_name() as CONSTRAINT_CATALOG ,user_name(c_obj.uid) as CONSTRAINT_SCHEMA ,c_obj.name as CONSTRAINT_NAME from sysobjects c_obj ,sysobjects t_obj where t_obj.uid = user_id() nd t_obj.id = c_obj.parent_obj and c_obj.xtype in ('C' ,'UQ' ,'PK' ,'F') Tem0=~1l --Identifies tables and columns owned by the current user the have constraints create view INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE ( TABLE_CATALOG ,TABLE_SCHEMA ,TABLE_NAME ,COLUMN_NAME ,CONSTRAINT_CATALOG ,CONSTRAINT_SCHEMA ,CONSTRAINT_NAME ) as select KCU.TABLE_CATALOG /*TABLE_CATALOG*/ ,KCU.TABLE_SCHEMA /*TABLE_SCHEMA*/ ,KCU.TABLE_NAME /*TABLE_NAME*/ ,KCU.COLUMN_NAME /*COLUM_NAME*/ ,KCU.CONSTRAINT_CATALOG/*CONSTRAINT_CATALOG*/ ,KCU.CONSTRAINT_SCHEMA /*CONSTRAINT_SCHEMA*/ ,KCU.CONSTRAINT_NAME /*CONSTRAINT_NAME*/ from INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU UNION select db_name() /*TABLE_CATALOG*/ ,user_name(t_obj.uid)/*TABLE_SCHEMA*/ ,t_obj.name /*TABLE_NAME*/ ,cols.name /*COLUMN_NAME*/ ,db_name() /*CONSTRAINT_CATALOG*/ ,user_name(c_obj.uid)/*CONSTRAINT_SCHEMA*/ ,c_obj.name /*CONSTRAINT_NAME*/ from sysobjects t_obj ,sysobjects c_obj ,syscolumns cols where t_obj.uid = user_id() and t_obj.id = c_obj.parent_obj and c_obj.xtype = 'C' and c_obj.info = cols.colid and cols.id = c_obj.parent_obj UNION select db_name() /*TABLE_CATALOG*/ ,user_name(t_obj.uid) /*TABLE_SCHEMA*/ ,t_obj.name /*TABLE_NAME*/ ,col.name /*COLUMN_NAME*/ ,db_name() /*CONSTRAINT_CATALOG*/ ,user_name(r_obj.uid) /*CONSTRAINT_SCHEMA*/ ,r_obj.name /*CONSTRAINT_NAME*/ FROM sysobjects t_obj ,syscolumns col ,systypes typ ,sysobjects _obj WHERE t_obj.uid = user_id() AND t_obj.id = col.id AND col.xusertype = typ.xusertype AND typ.xusertype > 256 -- UDF Type AND typ.domain = r_obj.id AND r_obj.xtype = 'R' < T Y T(x8L T0 DO(T,P T   D$4 TND4 T0 T( Ti Oi CREATE PROCEDURE sp_update_notification @alert_name sysname, @operator_name sysname, @notification_method TINYINT -- 1 = Email, 2 = Pager, 4 = NetSend, 7 = All AS BEGIN DECLARE @alert_id INT DECLARE @operator_id INT DECLARE @notification NVARCHAR(512) DECLARE @retval INT DECLARE @old_has_notification INT DECLARE @new_has_notification INT DECLARE @res_notification NVARCHAR(100) SET NOCOUNT N SELECT @res_notification = FORMATMESSAGE(14210) -- Remove any leading/trailing spaces from parameters SELECT @alert_name = LTRIM(RTRIM(@alert_name)) SELECT @operator_name = LTRIM(RTRIM(@operator_name)) -- Only a sysadmin can do this IF (ISNULL(IS_SRVROLEMEMBER(N'sysadmin'), 0) <> 1) BEGIN RAISERROR(15003, 16, 1, N'sysadmin') RETURN(1) -- Failure END -- Check if the Notification is valid EXECUTE sp_verify_notification @alert_name, @operator_name, @notification_method, @alert_id OUTPUT, @operator_id OUTPUT -- Check if this notification exists IF (NOT EXISTS (SELECT * FROM msdb.dbo.sysnotifications WHERE (alert_id = @alert_id) AND (operator_id = @operator_id))) BEGIN SELECT @notification = @alert_name + N' / ' + @operator_name RAISERROR(14262 16, 1, @res_notification, @notification) RETURN(1) -- Failure END SELECT @old_has_notification = has_notification FROM msdb.dbo.sysalerts WHERE (id = @alert_id) -- Do the UPDATE UPDATE msdb.dbo.sysnotifications SET notification_method = @notification_method WHERE (alert_id = @alert_id) AND (operator_id = @operator_id) SELECT @retval = @@error SELECT @new_has_notification = has_notification FROM msdb.dbo.sysalerts WHERE (id = @alert_id) -- Notiy SQLServerAgent of the change - if any - to has_notifications IF (@old_has_notification <> @new_has_notification) EXECUTE msdb.dbo.sp_sqlagent_notify @op_type = N'A', @alert_id = @alert_id, @action_type = N'U' RETURN(@retval) -- 0 means success END k iP T#   T!P T$  T$P T%  T%  P T&  T&4 TND4 T́C0\ lD `  L|\ dt$ <\ BEGIN DECLARE @message_id_as_char VARCHAR(10) SELECT @message_id_as_char = CONVERT(VARCHAR(10), @message_id) INSERT INTO #TempRetVal EXECUTE ('IF (' + @message_id_as_cf, O0r NaTS  dD c T(AtL`*E4,sp_delete_notification dO: TE0&tE@alert_name, 1` dz T&6t&@alert_name 0 dO; dK0&tK@operator_named dz d,6t,@operator_nameP d;( Tth P d;) dt\ BEGP d;) dt\ 16,P d ;) d tv8 EP d ;) d tv8eEvP d ;+ d t\ t_dT d ;- d ORM TMEt\ T d ;, d es_ alit\ P d;. dt]!me dt4 d T^0*tP *E4 ^sp_delete_notficationtit d& D:6t:sp_delete_notificationseD d! T tT d( T# 0t CREATE PROCEDURE sp_delete_notification @alert_name sysname, @operator_name sysname AS BEGIN DECLARE @alert_id INT DECLARE @operator_id INT DECLARE @ignored TINYINT DECLARE @otification NVARCHAR(512) DECLARE @retval INT DECLARE @old_has_notification INT DECLARE @new_has_notification INT DECLARE @res_notification NVARCHAR(100) SET NOCOUNT ON SELECT @res_notification = FORMATMESSAGE(14210) -- Remove any leading/trailing spaces from parameters SELECT @alert_name = LTRIM(RTRIM(@alert_name)) SELECT @operator_name = LTRIM(RTRIM(@operator_name)) -- Only a sysadmin can do this IF (ISNULL(IS_SRVROLEMEMBER(N'sysadmin', 0) <> 1) BEGIN RAISERROR(15003, 16, 1, N'sysadmin') RETURN(1) -- Failure END -- Get the alert and operator ID's EXECUTE sp_verify_notification @alert_name, @operator_name, 7, -- A dummy (but valid) value @alert_id OUTPUT, @operator_id OUTPUT -- Check if this notification exists IF (NOT EXISTS (SELECT * FROM sdb.dbo.sysnotifications WHERE (alert_id = @alert_id) AND (operator_id = @operator_id))) BEGIN SELECT @notification = @alert_name + N' / ' + @operator_name RAISERROR(14262, 16, 1, @res_notification, @notification) RETURN(1) -- Failure END SELECT @old_has_notification = has_notification FROM msdb.dbo.sysalerts WHERE (id = @alert_id) -- Do the Delete DELETE FROM msdb.dbo.sysnotifications WHERE (alert_id = @alert_id) AND(operator_id = @operator_id) SELECT @retval = @@error SELECT @new_has_notification = has_notification FROM msdb.dbo.sysalerts WHERE (id = @alert_id) -- Notify SQLServerAgent of the change - if any - to has_notifications IF (@old_has_notification <> @new_has_notification) EXECUTE msdb.dbo.sp_sqlagent_notify @op_type = N'A', @alert_id = @alert_id, @action_type = N'U' RETURN(@retvl) -- 0 means success END setP d   T'P d  dP d  d  P d  d4 d*E4 d́C0`p |\ dt$ <\Ba m)ni'^#$ mD c d(AL\F4(sp_help_notification mOC dG0&L G@object_type` mz d(6L(@object_typet mOD m90&L9@nameJT mz m6L@nameL| mOE mC0&L C@enum_type\ mz m$6L$@enum_type mOF mW0&L00W@notification_methodp m z  m8L8@notification_method m OG m G0&LG@target_name@` m z" m (6L(@target_nameP m ;B dLv8vP m ;C m L#,P m;C mL#,P m;B mLv8 mL4 m dZ0*LP F4 Zsp_help_notificationp m? d66L6sp_help_notificationiD m! d LH/F4SplitNxtD m  T-/i@&L m)('L m( d')L m' T(p)n m) ml0=~1l --Identifies tables and columns owned by the current user the have constraints create view INFORMATION_SCHEMA.CONSTRAINT_COLUMNUSAGE ( TABLE_CATALOG ,TABLE_SCHEMA ,TABLE_NAME ,COLUMN_NAME ,CONSTRAINT_CATALOG ,CONSTRAINT_SCHEMA ,CONSTRAINT_NAME ) as select KCU.TABLE_CATALOG /*TABLE_CATALOG*/ ,KCU.TABLE_SCHEMA /*TABLE_SCHEMA*/ ,KCU.TABLE_NAME /*TABLE_NAME*/ ,KCU.COLUMN_NAME /*COLUMN_NAME*/ ,KCU.CONSTRAINT_CATALOG/*CONSTRAINT_CATALOG*/ ,KCU.CONSTRAINT_SCHEMA /*CONSTRAINT_SCHEMA*/ ,KCU.CONSTRAINT_NAME /*CONSTRAINT_NAME*/ from INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU UNION select db_name() /*TABE_CATALOG*/ ,user_name(t_obj.uid)/*TABLE_SCHEMA*/ ,t_obj.name /*TABLE_NAME*/ ,cols.name /*COLUMN_NAME*/ ,db_name() /*CONSTRAINT_CATALOG*/ ,user_name(c_obj.uid)/*CONSTRAINT_SCHEMA*/ ,c_obj.name /*CONSTRAINT_NAME*/ from sysobjects t_obj ,sysobjects c_obj ,syscolumns cols where t_obj.uid = user_id() and t_obj.id = c_obj.parent_obj and c_obj.xtype = 'C' and c_obj.info = cols.colid and cols.id = c_obj.parent_obj UNION select db_name() /*TABLE_CATALOG*/ ,user_name(_obj.uid) /*TABLE_SCHEMA*/ ,t_obj.name /*TABLE_NAME*/ ,col.name /*COLUMN_NAME*/ ,db_name() /*CONSTRAINT_CATALOG*/ ,user_name(r_obj.uid) /*CONSTRAINT_SCHEMA*/ ,r_obj.name /*CONSTRAINT_NAME*/ FROM sysobjects t_obj ,syscolumns col ,systypes typ ,sysobjects r_obj WHERE t_obj.uid = user_id() AND t_obj.id = col.id AND col.xusertype = typ.xusertype AND typ.xusertype > 256 -- UDF Type AND typ.domain = r_obj.id AND r_obj.xtype = 'R' < m ( m)nx8L m0 T =~1)P m   d4 mF4 m0 m) m0LCREATE PROCEDURE sp_help_notification @object_type CHAR(9), -- Either 'ALERTS' (enumerates Alerts for given Operator) -- or 'OPERATORS' (enumerates Operatrs for given Alert) @name sysname, -- Either an Operator Name (if @object_type is 'ALERTS') -- or an Alert Name (if @object_type is 'OPERATORS') @enum_type CHAR(10), -- Either 'ALL' (enumerate all objects [eg. all alerts irrespective of whether 'Fred' receives a notification for them]) -- or 'ACTUAL' (enumerate only the associated objects [eg. only the alerts which 'Fred' receives a notfication for]) -- or 'TARGET' (enumerate only the objects matching @target_name [eg. a single row showing how 'Fred' is notfied for alert 'Test']) @notification_method TINYINT, -- Either 1 (Email) - Modifies the result set to only show use_email column -- or 2 (Pager) - Modifies the result set to only show use_pager column -- or 4 (NetSend) - Modifies the result set to only showuse_netsend column -- or 7 (All) - Modifies the result set to show all the use_xxx columns @target_name sysname = NULL -- Either an Alert Name (if @object_type is 'ALERTS') -- or an Operator Name (if @object_type is 'OPERATORS') -- NOTE: This parameter is only required if @enum_type is 'TARGET') AS BEGIN DECLARE @id INT -- We use this to store the decode of@name DECLARE @target_id INT -- We use this to store the decode of @target_name DECLARE @select_clause NVARCHAR(1024) DECLARE @from_clause NVARCHAR(512) DECLARE @where_clause NVARCHAR(512) DECLARE @res_valid_range NVARCHAR(100) SET NOCOUNT ON SELECT @res_valid_range = FORMATMESSAGE(14208) -- Remove any leading/trailing spaces from parameters SELECT @object_type = UPPER(LTRIM(RTRIM(@object_type))) SELECT @name = LTRIM(RTRIM(@name)) SELECT @enumtype = UPPER(LTRIM(RTRIM(@enum_type))) SELECT @target_name = LTRIM(RTRIM(@target_name)) -- Turn [nullable] empty string parameters into NULLs IF (@target_name = N'') SELECT @target_name = NULL -- Check ObjectType IF (@object_type NOT IN ('ALERTS', 'OPERATORS')) BEGIN RAISERROR(14266, 16, 1, '@object_type', 'ALERTS, OPERATORS') RETURN(1) -- Failure END -- Check AlertName IF (@object_type = 'OPERATORS') AND (NOT EXISTS (SELECT * FROM msdb.bo.sysalerts WHERE (name = @name))) BEGIN RAISERROR(14262, 16, 1, '@name', @name) RETURN(1) -- Failure END -- Check OperatorName IF (@object_type = 'ALERTS') AND (NOT EXISTS (SELECT * FROM msdb.dbo.sysoperators WHERE (name = @name))) BEGIN RAISERROR(14262, 16, 1, '@name', @name) RETURN(1) -- Failure END -- Check EnumType IF (@enum_type NOT IN ('ALL', 'ACTUAL', 'TARGET')) BEGIN RAISERROR(1466, 16, 1, '@enum_type', 'ALL, ACTUAL, TARGET') RETURN(1) -- Failure END -- Check Notification Method IF ((@notification_method < 1) OR (@notification_method > 7)) BEGIN RAISERROR(14266, 16, 1, '@notification_method', @res_valid_range) RETURN(1) -- Failure END -- If EnumType is 'TARGET', check if we have a @TargetName parameter IF (@enum_type = 'TARGET') AND (@target_name IS NULL) BEGIN RAISERROR(14502, 16, 1) RETURN(1) -- Failure END -- If EnumTpe isn't 'TARGET', we shouldn't have an @target_name parameter IF (@enum_type <> 'TARGET') AND (@target_name IS NOT NULL) BEGIN RAISERROR(14503, 16, 1) RETURN(1) -- Failure END -- H/F4SplitNextD m   m./@ L m!*0)'L m") m'*L m' m)@*eL m$0 mL*,P m%   m4 m F4 m 0""@"!!\!! \0 L| xXh88` 8\>,>=h..--4-,,,HLHGG\G8x8(877'd''&&@&P  `p  ""@"!!\!! \0 L| xXh8#y2d_ iotL_e6F$  m* m"0LTranslate the Name into an ID IF (@object_type = 'ALERTS') BEGIN SELECT @id = id FROM msdb.dbo.sysoperators WHERE (name = @name) END IF (@object_type = 'OPERATORS') BEGIN SELECT @id = id FROM msdb.dbo.sysalerts WHERE (name = @name) END -- Translate the TargetName into a TargetID IF (@target_name IS NOT NULL) BEGIN IF (@object_type = 'OPERATORS') BEGIN SELECT @target_id = id FROM msdb.dbo.sysoperators WHERE (name = @target_name ) END IF (@object_type = 'ALERTS') BEGIN SELECT @target_id = id FROM msdb.dbo.sysalerts WHERE (name = @target_name) END IF (@target_id IS NULL) -- IE. the Target Name is invalid BEGIN RAISERROR(14262, 16, 1, @object_type, @target_name) RETURN(1) -- Failure END END -- Ok, the parameters look good so generate the SQL then EXCUTE() it... -- Generate the 'stub' SELECT clause and the FROM clause IF (@object_type = 'OPERATORS') -- So we want a list of Operators for the supplied AlertID BEGIN SELECT @select_clause = N'SELECT operator_id = o.id, operator_name = o.name, ' IF (@enum_type = 'ALL') SELECT @from_clause = N'FROM msdb.dbo.sysoperators o LEFT OUTER JOIN msdb.dbo.sysnotifications sn ON (o.id = sn.operator_id) ' ELSE SELECT @from_clause = N'FROM msdb.dbo.sysoperators o, msdb.dbo.sysnotfications sn ' END IF (@object_type = 'ALERTS') -- So we want a list of Alerts for the supplied OperatorID BEGIN SELECT @select_clause = N'SELECT alert_id = a.id, alert_name = a.name, ' IF (@enum_type = 'ALL') SELECT @from_clause = N'FROM msdb.dbo.sysalerts a LEFT OUTER JOIN msdb.dbo.sysnotifications sn ON (a.id = sn.alert_id) ' ELSE SELECT @from_clause = N'FROM msdb.dbo.sysalerts a, msdb.dbo.sysnotifications sn ' END -- Add the required use_xxx columns to the ELECT clause IF (@notification_method & 1 = 1) SELECT @select_clause = @select_clause + N'use_email = ISNULL((sn.notification_method & 1) / POWER(2, 0), 0), ' IF (@notification_method & 2 = 2) SELECT @select_clause = @select_clause + N'use_pager = ISNULL((sn.notification_method & 2) / POWER(2, 1), 0), ' IF (@notification_method & 4 = 4) SELECT @select_clause = @select_clause + N'use_netsend = ISNULL((sn.notification_method & 4) / POWER(2, 2), 0), ' -- Remove the trailing comma SELECT @select_clause = SUBSTRING(@select_clause, 1, (DATALENGTH(@select_clause) / 2) - 2) + N' ' -- Generate the WHERE clause IF (@object_type = 'OPERATORS') BEGIN IF (@enum_type = 'ALL') SELECT @from_clause = @from_clause + N' AND (sn.alert_id = ' + CONVERT(VARCHAR(10), @id) + N')' IF (@enum_type = 'ACTUAL') SELECT @where_clause = N'WHERE (o.id = sn.operator_id) AND (sn.alert_id = ' + CONVERT(VARCHAR(10), @id) + N') AND (sn.notification_method & ' + CONVERT(VARCHAR,@notification_method) + N' <> 0)' IF (@enum_type = 'TARGET') SELECT @where_clause = N'WHERE (o.id = sn.operator_id) AND (sn.operator_id = ' + CONVERT(VARCHAR(10), @target_id) + N') AND (sn.alert_id = ' + CONVERT(VARCHAR(10), @id) + N')' END IF (@object_type = 'ALERTS') BEGIN IF (@enum_type = 'ALL') SELECT @from_clause = @from_clause + N' AND (sn.operator_id = ' + CONVERT(VARCHAR(10), @id) + N')' IF (@enum_type = 'ACTUAL') SELECT @where_clause = N'WHERE (a.id= sn.alert_id) AND (sn.operator_id = ' + CONVERT(VARCHAR(10), @id) + N') AND (sn.notification_method & ' + CONVERT(VARCHAR, @notification_method) + N' <> 0)' IF (@enum_type = 'TARGET') SELECT @where_clause = N'WHERE (a.id = sn.alert_id) AND (sn.alert_id = ' + CONVERT(VARCHAR(10), @target_id) + N') AND (sn.operator_id = ' + CONVERT(VARCHAR(10), @id) + N')' END -- Add the has_email and has_pager columns to the SELECT clause IF (@object_type = 'OPERATORS') BEGIN SELECT @selectclauMAT * 0Lse = @select_clause + N', has_email = PATINDEX(N''%[^ ]%'', ISNULL(o.email_address, N''''))' SELECT @select_clause = @select_clause + N', has_pager = PATINDEX(N''%[^ ]%'', ISNULL(o.pager_address, N''''))' SELECT @select_clause = @select_clause + N', has_netsend = PATINDEX(N''%[^ ]%'', ISNULL(o.netsend_address, N''''))' END IF (@object_type = 'ALERTS') BEGIN -- NOTE: We return counts so that the UI can detect 'unchecking' the last notification SELECT @select_clause = @select_clause + N', has_email = (SELECT COUNT(*) FROM sysnotifications WHERE (alert_id = a.id) AND ((notification_method & 1) = 1)) ' SELECT @select_clause = @select_clause + N', has_pager = (SELECT COUNT(*) FROM sysnotifications WHERE (alert_id = a.id) AND ((notification_method & 2) = 2)) ' SELECT @select_clause = @select_clause + N', has_netsend = (SELECT COUNT(*) FROM sysnotifications WHERE (alert_id = a.id) AND ((notification_method & 4) = 4)) ' END EXECUTE (@select_clause + @from_clause + @where_clause) RETURN(@@error) -- 0 means success END P    m&P   P     P   4 mF4 mGI d p2.protecttype = 204))) and p.action in (26,193,195,196,197) and p.id = o.id and o.xtype in ('U', 'V') and 0 != (permissions(o.id) & case p.action when 26 then 4 /*REFERENCES basebit on al_ SiE z `VF4 */ when 195 then 8 /*INSERT basebit */ when 196 then 16 /*DELETE basebit */ when 197 then 2 /*UPDATE basebit on all columns */ end) <- Z+x8L  F4 Q94(0'Z.0.vCREATE PROCEDURE sp_add_alert @name sysname, @message_id INT = 0, @severity INT = 0, @enabled TINYINT = 1,   D c m(AlG48trig_notification_ins_or_updP ;M m\ NULP ;N \   P ;M v8ob_P ;M v8 muT ;N INY NT v8P ;P \ tegL 1 m.0 AS \  \ D1 0 \    j0*TR\ G4 jtrig_notification_ins_or_updCL P TF6Ftrig_notification_ins_or_updrnD ! m \ < ' m$0CREATE TRIGGER trig_notification_ins_or_upd ON msdb.dbo.sysnotifications FOR INSERT, UPDATE AS BEGIN SET NOCOUNT ON -- First, throw out 'non-notification' row DELETE FROM msdb.dbo.sysnotifications WHERE (notification_method = 0) -- Reset the has_notification flag for the affected alerts UPDATE msdb.dbo.sysalerts SET has_notification = 0 FROM inserted i, msdb.dbo.sysalerts sa WHERE (i.alert_id = sa.id) -- Update sysalerts.has_notification (for email) UPDATE msdb.dbo.sysalerts SET has_notification = has_notification | 1 FROM msdb.dbo.sysalerts sa, msdb.dbo.sysnotifications sn, inserted i WHERE (sa.id = sn.alert_id) AND (sa.id = i.alert_id) AND ((sn.notification_method & 1) = 1) -- Update sysalerts.has_notification (for pager) UPDATE msdb.dbo.sysalerts SET has_notification = has_notification | 2 FROM msdb.dbo.sysalerts sa, msdb.dbo.sysnotifications sn, inserted i WHERE (sa.id = sn.alert_id) AND (sa.id = i.alert_id) AND ((sn.notification_method & 2) = 2) -- Update sysalerts.has_notificatin (for netsend) UPDATE msdb.dbo.sysalerts SET has_notification = has_notification | 4 FROM msdb.dbo.sysalerts sa, msdb.dbo.sysnotifications sn, inserted i WHERE (sa.id = sn.alert_id) AND (sa.id = i.alert_id) AND ((sn.notification_method & 4) = 4) END d-cP    P   P    4 G4 0 @ @|\\h\date = 0 SELECT @count_reset_time = 0 SELECT @has_notification = 0 IF (@category_name IS NULL) BEGIN SELECT @category_name = name FROM msdb.dbo.syscategories WHERE (category_id = 98) END -- Map a job_id of 0 to the real value we use to mean 'no job' IF (@job_id = CONVERT(UNIQUEIDENTIFIER, 0x00)) AND (@job_name IS NULL) o s   D c (AdhH40trig_notification_deleteP ;X v8P ;X v8 T ;Y  v8P ;Z \ P ;Z \ L 2 curent\  \ D2 0 0 \    b0*TR\ hH4 btrig_notification_deleteE x P >6>trig_notification_delete, D !  \  ' s0sCREATE TRIGGER trig_notification_delete ON msdb.dbo.sysnotifications FOR DELETE AS BEGIN SET NOCOUNT ON -- Reset the has_notification flag for the affected alerts UPDATE msdb.dbo.sysalerts SET has_notification = 0 FROM deleted d, msdb.dbo.ysalerts sa WHERE (d.alert_id = sa.id) -- Update sysalerts.has_notification (for email) UPDATE msdb.dbo.sysalerts SET has_notification = has_notification | 1 FROM msdb.dbo.sysalerts sa, msdb.dbo.sysnotifications sn, deleted d WHERE (sa.id = sn.alert_id) AND (sa.id = d.alert_id) AND ((sn.notification_method & 1) = 1) -- Update sysalerts.has_notification (for pager) UPDATE msdb.dbo.sysalerts SET has_notification = has_notificaion | 2 FROM msdb.dbo.sysalerts sa, msdb.dbo.sysnotifications sn, deleted d WHERE (sa.id = sn.alert_id) AND (sa.id = d.alert_id) AND ((sn.notification_method & 2) = 2) -- Update sysalerts.has_notification (for netsend) UPDATE msdb.dbo.sysalerts SET has_notification = has_notification | 4 FROM msdb.dbo.sysalerts sa, msdb.dbo.sysnotifications sn, deleted d WHERE (sa.id = sn.alert_id) AND sa.id = d.alert_id) AND ((sn.notification_method & 4) = 4) END iP    P   P    4 hH4 8 H XD$T`\ts WHERE (ISNULL(performance_condition, N'apples') = ISNULL(@performance_condition, N'oranges')) (tsd 0 JQ0v888 <OI4DMLUL v81 0V*# b Demo: Full msdb logMSSQLServermsdb01l v8G262Demo: Full msdb log IP  $v84 I4 0$hH severity, enabled, delay_between_responses, last_occurrence_date, last_occurrence_time, last_response_date, last_response_time, notification_message, include_event_description, database_name, event_description_keyword, occurrence_count, count_reset_date, count_ . <KJ4DML v8 0V*# b Demo: Full tempdbMSSQLServertempdbdeh v8 .6.Demo: Full tempdb@lP   v84 KJ4 08T @database_name, @event_description_keyword, @occurrence_count, @count_reset_date, @count_reset_time, ISNULL(@job_id, CONVERT(UNIQUEIDENTIFIER, 0x00)), @has_notification, @raise_snmp_trap, @performance_condition, @category_id) -- Notify SQLServerAgent of the change SELECT @alert_id = id FROM msdb.dbo.sysalerts WHERE (name = @name) EXECUTE msdbT LJ4update stats  0Rv8` 88 _WA_Sys_severity_173876EAH f  f J4?? B  f TTfff fe    WWv8ҀnefP   4 J4 ,0x8@\dgw~xT:4sp_update_alert&t +'90&gw9@name?@T U1(6gw@namem| , A0&gwA@new_name\ t LJ4update stats   0Rv8`_WA_Sys_event_description_keyword_173876EAH f   f J4??B  f TTfff fe     WWv8defP   4 J4 ,0x80`dge˿wt U6 :6gw:@notification_messageT 2 i0&gw00i@include_event_description_in& U3 J6gwJ@include_event_det LJ4update stats ! 0Rv8`AA _WA_Sys_database_name_173876EA@H f $ f J4???8B0msdb0tempdb f  TTfff fe !   WWv8m܀f P   4 J4 ,0x80`hd 26gw 2@occurrence_count 8 Q0&gw88 Q@count_reset_datell U1 26gw2@count_reset_date 9 Q0&gw88 X LJ4update stats " 0Rv8` 88 _WA_Sys_message_id_173876EAH f! d f! J4?? B *#*# f" TTf!ff fe "   WWv8eրtf"P   4 J4 ,0x8D`dU= &66gw6@last_response_time (> 'O0&gw00O@raise_snmp_traph )UC (06gw0@raise_snmp_trap *? )[0&gw& <J4DML v8 0V bDemo: Sev. 19 ErrorsMSSQLServerl v8 464Demo: Sev. 19 ErrorsP   v84 J4 0,Twv8P 0  0gwv8P 1  1gwv8P 2  2gwv8P 3  3gwv8P 4  4gwv8P 5  5& <J4DML v8 0V bDemo: Sev. 20 ErrorsMSSQLServerl v8 464Demo: Sev. 20 ErrorsP   v84 J4 0,Tgwv8  P =  =gwv8 PH/:4SplitNextD ?  4/`L @ < VXREOCL A 0L B  >& <,K4DML v8 0V bDemo: Sev. 21 ErrorsMSSQLServerl v8 464Demo: Sev. 21 ErrorsP   v84 K4 0,T8 I.vv8 @a.vv8  IN.vv8 @ac.vv8 INT.vv8 act.vv8 NT .vv8cti.vv8T .vv8xtr.vv8 .vv8tru.vv8 .vv8rio.vv8 .vv8ope.vv8e .vv8VAR.vv8etr.v]!T ,& < wK4DML  v8 0V bDemo: Sev. 22 ErrorsMSSQLServerl  v8 464Demo: Sev. 22 ErrorsP    v84  K4 0,Tx, x xLL,x  @y Iy @cy syy-- yoryy yforyCLAyLARyIFI<8z IN<8zsys<8z nv<8z NO<8z@re<8zw& < K4DMLz  v8 0V bDemo: Sev. 23 ErrorsMSSQLServerl  v8 464Demo: Sev. 23 ErrorsP    v84  K4 0,T IS| |e =|dbo|WHE|teg|cat| cat|SAG| --|dat| bu| av|faix}edux}e ax}ctix} (@x}001x}ivex}& <  L4DMLd_  v8 0V bDemo: Sev. 24 ErrorsMSSQLServerl  v8 464Demo: Sev. 24 ErrorsP    v84  L4 0,TIF Y`EGIY` NSAY`t Y`  anY` forY`  byY` NSEY`askY`Y`Y`Y`Y`-- Y` idY`sk_Y` Y`skiY` = Y`d t & < XL4DML  v8 0V  bDemo: Sev. 25 ErrorsMSSQLServerl  v8 46 4Demo: Sev. 25 ErrorsP    v84  L4 0,TKgwv8un_P L  Lgwv8BACP M  Mgwv8F (P N  Ngw0nddP O  Ogws 0)P P  Pgws P Q6 X( D c (A0)P L4backupmediaset  `$V0&88 IVmedia_set_id`  z6 m (6(media_set_id|  ` C0&$$Cmedia_uuid\  z7 $6$media_uuid  ` S0&00Smedia_family_countl  z6 464media_family_countp  ` 70&7nameP  z96name  ` E0&Edescription`  z6 &6&description  ` I0&Isoftware_named  z; *6*software_name  ` S0&88 Ssoftware_vendor_idl  z< 464software_vendor_id  ` Q0&00QMTF_major_versionl  z: 262MTF_major_version D   m!/` D  c /eptL   8ZL   .D,  cL     z0R3^zbackupmediaset  x8    N0*U  L4 Nbackupmediaset4d   m*6*backupmediasetD  !  D c (A0)iM@  x8XXHY0Hx8@9@x8S(Q0x888 @(Q0Y0x8tx8 Y0x8C@(Q0Y0d_Y0[sysobjts]dQwx8x8Hx8%x x8x8`Axx8q%xx8%xx9bx8$x9bx8Q0 Q0D/[0x8Y0>x8Y0Y0[Tx8Y0Y0@OW0[0uu|Q0(Q0 09 0Q0`x8@Q0, Q0Q0|x8*@DQ0x8H388 PK__backupmediaset__07C129300R3^zbackupmediasetx8"gU/`m/XT0/d/7U/`mx8v^bx8Tx8^bC0x8f,bTx8,0 C//x8 x8HbC8x80:Wvj0,/x8cbC/X0,0C/x80,0x8)b,0d0x8jc,0x8Cx80<7x8x8Yvx8́C,0$x8 0*N .28x8  Tx8v`x8hhhx8uv(x8px8x8$x8U  D    / (@`venD  c !/ p L !  8ZL "  ".,  Hc8 $   D %  !"/ NU`L) L &  #4 @_a8 '  %ibP$H < P 0 | 0  l(x ,lt<\job' IF (@job_id = CONVERT(UNIQUEIDENTIFIER, 0x00)) AND (@job_name IS NULL) SELECT @job_name = N'' -- Only a sysadmin can do this IF (ISNULL(IS_SRVROLEMEMBER(N'sysadmin'), 0) <> 1) BEGIN RAISERROR(15003, 16, 1, N'sysadmin') RETURN(1) END -- Check if SQLServerAgent is in the process of starting EXU   , (  L   .OTS D   &` D   /p 1,0'@n   z0R3^zbackupmediasetnc4  c h`   0RH3v88 PK__backupmediaset__07C12930,   0RH3v88 PK__backupmediaset__07C1293026   0RH3v88 PK__backupmediaset__07C12930  f# TT     WWesvnxe_ef#L     !   0)  " j0*0)PKL4 jPK__backupmediaset__07C12930   F60)FPK__backupmediaset__07C12930stD  !  0)P    P    P    4  L4 XtP0DD_id = sjv.job_id FROM msdb.dbo.sysalerts sa, msdb.dbo.sysjobs_view sjv WHERE (sa.job_id = sjv.job_id) AND (sa.name = @name) -- Fill out the values for all non-supplied parameters from the existsing values IF (@enabl  X0L4$backupmediasetuuid @ x8XXH x8x8H$$88 xx9bx9bx8Q0D/[0x8Y0>x8Y0Y0[x8x8//x8hx8x8/Ğ/Xx8fhx8/d0x8Ğ//x8whd0x8gx8d0x8d0px8|x8uvx8gd0/(x8hHx8//x8//t/,x8hx8x8x8/Ğ/Xx8fhx8x8/d0x8Ğ// $$88 backupmediasetuuid0RH3x88 PK__backupmediaset__07C12930f#tx8px8x8PK__backupmediaset__07C12930U !D   / GIN` D  c /0FaipureL   8ZL   .ift ,  c8   ,  P  $ twP  ( ,  0R $$88 backupmediaseuuid  0R $$88 backupmediasetuuid  0R $$88 backupmediasetuuid f$ TT    WWL)EĀ_naf$L   !# D   P   P   4 L4 `\<p  TXpPDATE UPDATE msdb.dbo.sysalerts SET name = @new_name, message_id = @message_id, severity t,  D c (AiMq XL4"backupmediafamilyn ` G0&iM88 Gmedia_set_idm` z> (6iM(media_set_id ` [0&iM00[family_sequence_numberet z> <6iM<family_sequence_number ` M0&iM$$ Mmedia_family_id h z? .6iM.media_family_idI ` E0&iM88 Emedia_countou` z? &6iM&media_count_ ` U0&iMUlogical_device_name p z? 66iM6logical_device_name ` W0&iMWphysical_device_name_p zC 86iM8physical_device_name ` E0&iM00Edevice_type ` z> &6iM&device_typec `  U0&iM88 Uphysical_block_size p zD66iM6physical_block_sizeoD  iM #/ng`e X/L4"AllocMixedExtent 8 c TF08  cN0F4 L4 /D  c 4/ @palL  0iM8ZL  0iM . U, iM0cL iM"  0RiM"?0^backupmediafamily iMx8 $ T0*iMU L4 Tbackupmediafamilyh  06iM0backupmediafamilyD !!  iMD c (Aq ە @ !x8XXH#Y0iMHx8@9@ x8S(Y0x888 00Y0x8C@(Y03Y0d_3Y0[sysobjts]dQwx8x8Hx8%x x8x8`Axx8q%xx8%xx9bx8$x9bx8Y0 Y0D/[0x8;Y0>x8;Y0;Y0[Tx8.Y0;Y0@oY0[0uu|Y0(Y0 09 0Y0`x8@Y0, Y0Y0|x8@DY0x8iMH"?088 00PK__backupmediafamil__09A971A20RiM"?0^backupmediafamily?/k/XT0/dm/7?/kx8v^bx8Tx8^bC0x8f,bTx8,0$C//x8$x8HbC8x80EiMWvj0,/x8cbC/X0,0C/x80,0x8)b,0d0x8jc,0x8Cx80<7x8x8Yvx8́C,0iM$x8h 0*T .28x8iMiMU Tx8v`x8hhhx8uv(x8piMx8x8$x8iMU D # iM 5/ ` D $ c $6/ p L% 2iM 8Z1L & 2iM &. 1 , #iM2Hc8 (iM #1 D ) iM %7/ t`heL * 2iM '4l3n8 +iM )3'<Ht4 D h  X LLlll $(4\ert_id = @alert_id, @action_type = N'D' RETURN(0) -- Success END DoP_   P_ _P_ _  P *p "\  , ,iM #L  0iM .XD  iM *#` 8 c C !0ە iM!D 9(  iMە D A4  ە  ە ( n0*ە F iML4 nFK__backupmed__media__0A9D95DBe  J6ە JFK__backupmed__media__0A9D95DBaD !  iMە P   P  P   P  4 L4  D ` 4  0  `Tl  P Dhen 195 then 'INSERT' when 196 then 'DELETE' when 197 then 'UPDATE' en9m  `0L4*backupmediafamilyuuidsp iM@ x8XXHiM w \wa\x88V$$ 88 000#x8A:jF x8g x8x8gx8x8x8(x8gD 4  8 x8 /gx8(x8$x87x8gx8x8(/x8U0,0c/h0,0x8,0$/x80x8,0CcAc<Y0,0pox8! `x8@ 0Rx8{8Zft,0x8<Y0 0 0x8,x8x8Xvx8iE0<Y00 x8// x8hx8x8/Ğ/Xx8fhx8/d0x8Ğ//x8whd0x8gx8d0d0px8|x8uvx8gd0/(x8hLx8//x8"b4x8,j4x8 j@IPx8x8//` /,x8hx8x8x8/Ğ/Xx8fhx8x8/d0x8Ğ//iM $$ 88 00backupmediafamilyuuid0RiMH13"?2܀88 00PK__backupmediafamil__09A971A2f%tx8px8x8PK__backupmediafamil__09A971A2iMU D  iM #/ )) ` D  c 4/0id p ' L  0iM 8ZL  0iM . R , iM0 c8 iM ), iM P   $ iMP   ( iM   0RiM 0$$ 88 00backupmediafamilyuuid   0RiM 0$$ 88 00backupmediafamilyuuid   0RiM 0$$ 88 0backupmediafamilyuuid f& TT     WWiM@f&L $ iM iMD$  iMP   !P   4 M4 lL@80(\$`x_days_p~S~a0&.gz88 a@weekday_pager_start_time |~ Uc~ 0,nIJ D c (A Mޅ H4M4backupset `# X0& 88 KXbackup_set_idd zH *6 *backup_set_id8 `$ M0& $$Mbackup_set_uuidh zI .6 .backup_set_uuid `% G0& 88 Gmedia_set_id` zJ (6 (media_set_id `& U0& 00Ufirst_family_number*p zJ 66 6first_family_number, `' S0& 44Sfirst_media_numberl zK 46 4first_media_number `( S0& 00Slast_family_numberl zL 46 4last_family_number `) Q0& 44 Qlast_media_numberl zM 26 2last_media_numberU `* Y0& 00"Ycatalog_family_numbert zJ :6 :catalog_family_numberO `+ W0& 44 # Wcatalog_media_numberp zK 86 8catalog_media_numberx `, ?0& 88 % ?positionX zQ  6  position `- M0& == ) Mexpiration_dateUh zL .6 .expiration_dateA `. S0& 88 1 Ssoftware_vendor_idl zS 46 4software_vndor_idp `/ 70&  7nameP zR 6 name `0 E0& Edescription` zL &6 &descriptionA| `1 A0& Auser_nameC\ zV "6 "user_name `2 [0& 005[software_major_version t !zU <6 <software_major_version "`3 ![0& 006[software_minor_versiont #zV "<6 <software_minor_version $`4 #[0& 447[software_build_versiont %zU $<6 <software_build_version| &`5 %A0& 449Atime_zoneO\ 'zY &"6 "time_zone* (`6 'Q0& 00;Qmtf_minor_versionOl )zS (26 2mtf_minor_versionA| *`7 )A0& ll <Afirst_lsn\ +zO *"6 "first_lsnx ,`8 +?0& ll I?last_lsnX -zR , 6  last_lsn .`9 -K0& ll VKcheckpoint_lsnpd /zL .,6 ,checkpoint_lsn 0`: /U0& ll cUdatabase_backup_lsnp 1zM 066 6database_backup_lsn@ 2`; 1[0& ==p[database_creation_datet 3zN 2<6 <database_creation_ate 4`< 3Q0& ==xQbackup_start_datel 5zJ 426 2backup_start_date 6`= 5S0& ==Sbackup_finish_datel 7zH 646 4backup_finish_datep 8`> 770& 7typeP 9zb 86 type| :`? 9C0& 44Csort_order\ ;za :$6 $sort_order| <`@ ;A0& 44Acode_page.gz\ =zO <"6 "code_page >`A =U0& 00Ucompatibility_levelyp ?zP >66 6compatibility_level @`B ?O0& 88 Odatabase_versionh AzS @06 0database_version B`C AE0& ll !!Ebackup_size` CzK B&6 !&backup_sizee D`D CI0& ""Idatabase_nameEMd EzT D*6 "*database_nameaH/9M4SplitNextD G  /s @TAL H`&yL I` Ey_EL Jy;(`h'H K I3AQA?KU[QS7CAUOEITIKEAIJFM<UT;AKG=C??GUUQQ;;S7=EIEA0& 449Atime_zoneDA0& 00;Qmtf_minor_version 0& ll <Afirst_lsn '0& ll I?last_lsn 0& ll VKcheckpoint_lsn 0& ll cUdatabase_backup_lsn_n0& ==p[database_creation_date)0& ==xQbackup_start_date e0& ==Sbackup_finish_date(0& 7typen0& 44Csort_ordert0& 44Acode_page 0& 00Ucompatibility_level.a0& 88 Odatabase_versiona0& ll !!Ebackup_size 0& ""Idatabase_name.a0&> 88 GTinstance_id0&> <Isource_server 0&> 00Koperation_code 0&> 00 Eobject_typeEF0&> $$ Aobject_id/ 0&> <Itarget_servereb0&> !Jerror_messageh0&> ==Z3Fdate_posted 0&> == " Mdate_downloadedwh0&> 00 *W <status0&>  Udeleted_object_name0&w 88 GTinstance_id0&w $$;job_id0&w 88 =step_id0&w Astep_name0&w 88 Ksql_message_idr0&w 88  Gsql_severity 0&w =message_pa0&w 88 $"Crun_statusy0&w 88 ( &?run_dateu0&w 88 , *?run_time 0&w 88 0 .Grun_durationT0&w 88 4 2Uoperator_id_emailedARC0&w 88 8 6Uoperator_id_netsent --0&w 88 <:Qoperator_id_pagedRIM0&w 88 @>Qretries_attemptede n0&w <;serverR0& $$;job_id)0& <Soriginating_server 0& 7nameT0& 00=enabled '00& Edescription(@p& 88 Istart_step_id1, 0& 88 Ecategory_id -0& UAowner_sidime< L `5 J3x8L M _jP N  4 G9M4 G03 F LE0& ##Eserver_name @r` Qzb F&6 #&server_nameet R QG0& $$Gmachine_namee` Sz^ R(6 $(machine_nameD T  H8/e <` 0)D U c U9/namp = L V 5  8Z4L W 5 W.E 4or, T 5cL Y4 0 Z  p0R 445^pbackupset [ x8| \* D0* U $ 9M4 DbackupsetX ]  6  backupsetD ^!%   D c (AMޅ z @ _x8XXHcZ0 Hx8@9@x8S(@Z0x888 @(@Z0nZ0x8tx8 Z0x8C@(@Z0sZ0d_sZ0[sysobjts]dQwx8x8Hx8%x x8x8`Axx8q%xx8%xx9bx8$x9bx8@Z0 SZ0D/[0x8{Z0>x8{Z0{Z0[Tx8nZ0{Z0@Z0[0uu|@Z0(@Z0 09 0VZ0`x8@@Z0, VZ0@Z0|x8*@D@Z0x8 H44588 PK__backupset__0C85DED0R 445^pbackupsetTx80x8"g/`+/XT0/d+/7/`+x8v^bx8Tx8^bC0x8f,bTx8,0*C//x8*x8HbC8x80 Wvj0,/x8cbC/X0,0C/x80,0x8)b,0d0x8jc,0x8Cx80<7x8x8Yvx8́C,0 $x8 0*D .28x8  U $ Tx8v`x8hhhx8uv(x8p x8x8$x8 U $ D a  V:/`QCD b c b;/pL c 7  8Z6L d 7 d.6, a 7Hc8 f a6 X/9M4"AllocMixedExtent 8 hc G08 i c G4 h9M4 h/D g  c</ `&L l 7 e4E8&8 m g8MHdH HGG|G$GFFtF(FEE`776665<544x4,433D32d211`110!D! h 8Xhh 4hHpx,$, P   ( X XPX`hh 4\QCONSTR40=de" J ", n  aL " 5 X.4A D "  l8`SC HE8 c jF !0z  !_pD "9   z D "A  z  "z ". "n0*z F  BM4 nFK_backupset__media__0D7A0286 " "J6z JFK__backupset__media__0D7A0286D "! "  z P "  OP "  "P "  "P "  " $$4 BM4 @ P 8 p , l(,tT Dh0P DK@category_namecd$-#,6KR[{ ,@category_nameP%n ~)KR[{sd_eP&n &KR[{s msP'_fk )P0GM4backupsetuuid ) @ )x8XXH x8VI$$88 xx9b9bx8A:jF x8g x8x8gx8x8gx8x8gD "  8 x8 "/gx8(x8$x87x8gx8x8(/x8U0,0c/h0,0x8,0$/x80x8,0CcAc<Y0,0pox8! xx8xx8j0,0x8/:sZft,0x8<Y0 U0!x8,x8x8Xvx8iE0<Y0,0 x8//8 x8hx8x8/Ğ/Xx8fhx8/d0x8Ğ//x8whd0x8gx8d0d0px8|x8uvx8gd0/(x8hLx8//x8"b4x8,j4x8 j@IPx8x8// /,x8hx8x8x8/Ğ/Xx8fhx8x8/d0x8Ğ// $$88 backupsetuuid0R H687x88 PK__backupset__0C85DE4Df'tx8px8x8PK__backupset__0C85DE4D U $!D )  "8/ d_t`me D ) c )9/0 p L ) 5  8Z4L ) 5 ).e 4 , ) 5c8 ) )4ca, )   )P )   " $  LTP )   ) (   S )   ) 0R 445$$88 backupsetuuid    ) 0R 445$$88 backupsetuuid )  )0R 445$$88 backupsetuuid )f( " TT4 ) c )jba )  )  WW    f(L )* "!tar#_ti  ) D* ) ) P )  "!P )  )4 )GM4 )hdDxDxLP h @category_name, @category_id OUTPUT IF (@return_code <> 0) RETURN(1) -- Failure -- Finally, do the INSERT INSERT INTO msdb.dbo.sysoperators (name, enabled, email_address, last_email_date, )3~!" 5D c "(A&nJbHM4backupfile 5y  KI0&&n88 Ibackup_set_iddayd 5z T*6&n*backup_set_id 5y  5U0&&n00Ufirst_family_number 0p 5z 566&n6first_family_numberkd 5y  5S0&&n44 Sfirst_media_number l 5z 546&n4first_media_number 5y 5K0&&nKfilegroup_named 5 z 5,6&n,filegroup_name| 5 y 5 A0&&n88  Apage_size\ 5 z 5 "6&n"page_size< 5 y 5 E0&&nll Efile_numberx` 5 z 5 &6&n&file_number 5y 5 W0&&nll Wbacked_up_page_countp 5z 586&n8backed_up_page_count| 5y 5A0&&n!Afile_type\ 5z 5"6&n"file_type\5y 5[0&&nll " [source_file_block_sizet 5z 5<6&n <source_file_block_size| 5y 5A0&&nll  + Afile_size\ 5z 5"6&n "file_size 5y5G0&&n Glogical_name` 5z 5(6&n (logical_name 5y 5K0&&n Kphysical_drived 5z 5,6&n ,physical_drive 5y 5I0&&n Iphysical_named 5z 5*6&n *physical_nameeD 5 &n )=/`D 5 c 5>/dptL 5 :&n 8Z9L 5 :&n 5.s9t, 5&n:cL 5!9&n88   ) 5" 5#r0R&n998Z:^rbackupfilevO 5$&nx8 5%0 )F0*&nU  M4 Fbackupfile\ 5& ""6&n"backupfilD 5'!) " &nD c 5(AJb1oV@ 5(x8XXHV0&nHx8@9@x8S(P0x888 ll V0x8C@(P0V0d_V0[sysobjts]dQwx8x8Hx8%x x8x8`Axx8q%xx8%xx9bx8$x9bx8P0 P0D/[0x8V0>x8V0V0[Tx8V0V0@X0[0uu|P0(P0 09 0P0`x8@P0, P0P0|x8*@DP0x8&nH998Z:88 ll PK__backupfile__0F624AF80R&n998Z:^rbackupfilex80x8"g?/k/XT0/d/I7?/kx8v^bx8Tx8^bC0x8f,bTx8,00C//x80x8HbC8x80(&nWvj0,/x8cbC/X0,0C/x80,0x8)b,0d0x8jc,0x8Cx80<7x8x8Yvx8́C,0&n$x8 0*F .28x8&n&nU Tx8v`x8hhhx8uv(x8p&nx8x8$x8&nU  D 5* &n 5?/`D 5+ c 5+@/lpL 5, <&n 8Z;L 5- <&n 5-.;, 5*&n<Hc8 5/&n 5*;D 50 &n 5,A/`L 51 <&n 5.4L=8 52&n 50= P  TH(\$ `  ( @ \  $$Dl(\0XGvO|#IPI  Nde * " F, 53&n 5*L F :&n 5 .9E D F &n 51=`sna e, D F  F>/ped 0 F 5$r0R&n998Z:^rbackupfileINH/M4SpliNextD F  FB/sta`t_tL F  ^@ > L F>/RL F  F-->ov F > F v0R"U@}%>"~$$88 clustof re0R"U{{ &|88 $$88 nc1pf da0R[y@J]$$88 clustqf ag0R[y"ր$$$$88 nc1rf I0R[y^vtsysjobstepste0R@Ti$$clustsf _n0R"88 $$nc1tfRI0Rs@  88 clustuf 0Rg@,x88 clustvf 0RgHN<88 nc1wf 0Rx.P@xclustxfTS0RRD@ 88 88 clustyfQL0RRD  88 88 88 nc1zfcu0Rv8@V  xByName{f0Rv8 88 ByID|f0Rv8` Ҁ88 _WA_Sys_severity_173876EAf, 0Rv8`_WA_Sys_event_description_keyword_173876EAf0Rv8`AA ܀_WA_Sys_dataase_name_173876EAf 0Rv8` ր88 _WA_Sys_message_id_173876EAf" 0R#,@>xByName}f0R#, 8 ByID~f0R\ @ ̀88 88 ByAlertIDAndOperatorIDf0R@3"$$88 clustf_p< F  F >Vx8HF  ^"U>4 FM4 F0 F F 0R&nH;=8Z<88 ll PK__backupfile__0F624AF8LE F F0R&nH;=8Z<88 ll PK__backupfile__0F624AF8rn F F0R&nH;=8Z<88 ll PK__backupfile__0F624AF8or Ff) )TT F F  WW&n @aЀ f)L F0 5&  &n F&n FJb F2 Fb0*JbPK&nM4 bPK__backupfile__0F624AF8 x F 5'>6Jb>PK__backupfile__0F64AF8 D F! 5( &nJbD c 5)(A1oVjJD* Fg F L F* F NU L)   F \ F> "!01oV&n !IN D F9 " &n1oVD F A "  1oV F!1oV F"4 Fn0*1oVF &nM4 nFK__backupfil__backu__10566F31s, F# FJ61oVJFK__backupfil__backu__10566F31saD F$! F &n1oVP F%  P F&  F&P F'  F'P F(  F( 4 5M4 5x(hHdDP l`hpxD4P Dy will download the new MSXOperator details IF ((@name = N'MSXOperator') AND )2 8bt&p%& VD c F(AjJ>PM4restorehistory V Kb0&jJ88 Ubrestore_history_idl V146jJ4restore_history_id V  VG0&jJ==Grestore_date` V1 V(6jJ(restore_date V  Va0&jJadestination_database_namee OH/M4SplitNextD V  F/Ser@erAL V  L V  V  P V  F)L V Nbalil V  V "(4..22(*<<80"**&,&*&6,> *"&8&,"&,",&00*>2B (0B8844$80: &*..22...*$>B:><@ 6&6& ""**$("& (":>>*(($>*&0((6[y"subsystem 6jJ(restore_date6jJ4restore_history_id6 .active_end_dateSS6.active_end_time 6 2active_start_date 6 2active_start_time 6(date_created6enabledri6*freq_interval 6 <freqrecurrence_factor6 <freq_relative_interval68freq_subday_interval60freq_subday_type6"freq_typexp6job_id6name6*next_run_dateLS6*next_run_time 6&schedule_iddd6s,category_class6s&category_id 6s*category_typele6sname6g&enlist_date N6g 6enlisted_by_nt_user 6g,last_poll_date6g>local_time_at_last_pollet6g location6g *poll_interval 6g"server_id_o6g&server_namere6gstatus6g8time_zone_adjustment6? \&nlist_date) 6? \,last_poll_date6? \"server_idRT6? \&server_name S6x.Pname6x.P,servergroup_id6RD"server_idL_6RD,servergroup_id6v8&category_idSe6v80count_reset_date6v80count_reset_time6v8*database_name 6v8 >delay_betwee_responsesal6v8enabled t6v82event_category_idy 6v8Bevent_description_keyword6v8 event_id6v8(event_source6v8flags6v80has_notification6v8id6v8Binclude_event_description6v8job_id6v8 8last_occurrence_date6v8 8ast_occurrence_time6v8 4last_response_date6v8 4last_response_time6v8$message_id6v8name6v88notification_message6v80occurrence_count6v8:performance_condition@6v8 severity6#,&category_id>6#,*email_address_-6#,enable6#,id6#,.last_email_date6#,.last_email_time6#,2last_netsend_dater6#,2last_netsend_time6#,.last_pager_date6#, .last_pager_time6#,name6#,.netsend_address6#,*pager_addressY6#,$pager_days6#, >saturday_pagr_end_time6#, Bsaturday_pager_start_timer6#,:sunday_pager_end_time6#,>sunday_pager_start_timeP6#, <weekday_pager_end_time6#, @weekday_pager_start_time6\  alert_id6\ 6notification_method6\ &operator_id6job_id6ask_id\6,6@is_sysadmin_member6,&@login_name6@P@lang6@P@msgnum 6@P @msgtext6@P @replace6@P"@severity6@P"@with_log6yt@lang6yt@msgnum6@error6*@all_counters6$ *@counter_name6$ $@nt_lagid6]!(@action_type6]!"@alert_id6]!&@error_flag6]!@job_id6]! @op_type6]!(@schedule_id6M#@job_id6M#"@job_names6M#:@name_of_id_parameter6M#>@name_of_name_parametere6M#>@sqlagent_starting_test6r$@job_i6r$*@program_name6A%(@server_name6zz&@job_id6zz&(@object_type6zz&$@operation6zz&>@specific_target_server6zz&@value6c(*@jobs_deleted6c(&@msx_serverD6%'W)0@new_server_name6%'W)(@server_name6^KK*(@description< V 0 V x8` V#~&6[y&subsystemP V  V 4 VM4 V0| V VB6jJBdestination_database_name| V  VA0&jJAuser_name\ V V"6jJ"user_name,k V  VI0&jJ88 Ibackup_set_idd V V*6jJ*backup_set_id V VG0&jJGrestore_typef` V V(6jJ(restore_typex V V=0&jJhh =replacebX V V6jJreplacex V V?0&jJhh ?recoveryX V V 6jJ recoveryx V V=0&jJhh  =restartPX V V6jJ restartx V V=0&jJ==  =stop_atX V   V6jJ stop_at V! V G0&jJ00  Gdevice_count` V" V!(6jJ (device_countD V# jJ V =/ `[D V$ c V$>/0pL V% :jJ 8Z9$$P$#p##"H"!x!! 0 Ph 0Tx04H\h 8Xhh 4h P  Tx($$P$#p##"H"!x!! 0 Ph 0Tdntedlne_& iL V& :jJ V&.x}9, V#jJ:cL i9jJ i> F z0RjJ995:^zrestorehistoryha ijJx8 i6 F#N0*jJU  M4 Nrestorehistoryncd i F$*6jJ*restorehistorye D i!- F% jJD c V(A>2@ ix8XXHP0jJHx8@9@x8S(V0x888 @(V0P0x8tx8 P0x8C@(V0P0d_P0[sysobjts]dQwx8x8Hx8%x x8x8`Axx8q%xx8%xx9bx8$x9bx8V0 V0D/[0x8P0>x8P0P0[Tx8P0P0@OX0[0uu|V0(V0 09 0V0`x8@V0, V0V0|x8*@DV0x8jJH995:88 PK__restorehistory__123EB7A30RjJ995:^zrestorehistoryx8"gC//XT0/dl/hL7C/x8v^bx8Tx8^bC0x8f,bTx8,06C//x86x8HbC8x80 jJWvj0,/x8cbC/X0,0C/x80,0x8)b,0d0x8jc,0x8Cx80<7x8x8Yvx8́C,0jJ$x8 0*N .28x8jJjJU Tx8v`x8hhhx8uv(x8pjJx8x8$x8jJU  D i  jJ V%C/nam` = X/M4"AllocMixedExtent@8 i c iH08 i  c "H4 i M4 i /D i  c i D/DECpAREL i @jJ 8Z?L i @jJ i.LA?b_, i jJ@Hc8 ijJ i ?etD i jJ iE/NT ` DL i @jJ i4 A 8 ijJ iA Nt(4p8d$8d any leading/trailing spaces from parameters SELECT @name = LTRIM(RTRIM(@name)) SELECT @reassign_to_operator = LTRIM(RTRIM(@reassign_to_operator)) -- Turn [nullable] empty string parameters into NULLs IF (@reassign_to_operator = N'') SELECT @reassign_toy!  t, ijJ i L t :jJ i.9N'inD t jJ i=`rat r e8 c iG/pe))0 t> iz0RjJ995:^zrestorehistorLO4 t c tBh` t> t0RjJH?A5@v88 PK__restorehistory__123EB7A3t t> t0RjJH?A5@v88 PK__restorehistory__123EBA3F t > t 0RjJH?A5@v88 PK__restorehistory__123EB7A3'S t f* FTT t > t   WWjJmsvrxULLf*Lt 6 i OM !sdbjJ t jJ t> t8 t j0*>PKjJM4 jPK__restorehistory__123EB7A3 N t iF6>FPK__restorehistory__123EB7A3NUD t! i jJ>D c i (A2'D* tg 0 t \ t> F!02jJ ! D t9 F  jJ2D tA F!  2 t2 t: tn0*2F jJM4 nFK__restorehi__backu__1332DBDCto t tJ62JFK__restorehi__backu__1332DBDC''D t! t jJ2P t  VP t  tP t  tPt  t 4 VM4 VL \ D | 8 x4,hH| 8P D0%XL % X&L X%m&X & M @0x}M --Identifies user defined datatype accessible 7y {d0M4.restorehistorybackupset a {jJ@ {x8XXHjJ x8 Vx888 88 xxxx8A:jF x8g x8gx8U0|x8gx8/|gtA F! 8 x8 t/g,x8 x8#x8g/x8x8$x8x8U0,0x8(/h0,0/0$/x8/,x8,0Cc 2Ac<Y0,0powP! tx8tx80,0x84F0x8t,0x8<Y0 x8,0 x8Xvx8iEcdY00 /@I,0x8//D x8hx8x8/Ğ/Xx8fhx8/d0x8Ğ//x8whd0x8gx8d0d0px8|x8uvx8gd0/(x8hLx8//x8"b0x8,j0x8 j@IPx8 X0x8// /,x8hx8x8x8/Ğ/Xx8fhx8x8/d0x8Ğ//jJ  88 88restorehistorybackupset0RjJH?A5@x88 PK__restorehistory__123EB7A3f*tx8px8x8PK__restorehistory__123EB7A3jJU  !D { jJ t=/ (n`tifD { c {>/0_idp= @L { :jJ 8Z9L { :jJ {. 9 ,{jJ:c8 {jJ {9 , { jJ {P { > t $ jJE P { > { ( jJR( { > { 0RjJ99  :88 88 restoreistorybackupset { > { 0RjJ99  :88 88 restorehistorybackupset {> {0RjJ99  :88 88 restorehistorybackuset {f+ t TT {> {  WWjJ@c@΀ge_f+L {6 t!UBS#RINjJ {jJD6 { {jJP {  t P {  {4 {M4 {4` ,`(d |_id END DEALLOCATE jobs_referencing_this_operator -- Finally, do the actual DELETE DELETE FROM msdb.dbo.sysoperators WHERE (id = @id) COMMIT TRANSACTION RETURN(@@error) -- 0 means success END RP   ph ,D&\  D c t(A'N$LN4restorefile 3 V"S0&'88 Srestore_history_idl + V#46'4restore_history_id 4 E0&'ll Efile_number` + &6'&file_number 5 [0&'[destination_phys_drivet + <6'<destination_phys_drive 6 Y0&'Ydestination_phys_name`t  , :6':destination_phys_nameD   ' {F/`D   c  G/pL, L   C' 8ZBL   C'  .7~B,  'CcL B' >  {t0R'BB.C^trestorefile 'x8 < {H0*'U N4 Hrestorefile\  t$6'$restorefileD !1 t 'D c (AN$HD6 g jJL 6  jJ jJ\ > t!0N$'jJ!D 9 t 'N$D A t jJN$ N$ > n0*N$F 'N4 nFK__restorefi__resto__151B244E  J6N$JFK__restorefi__resto__151B244ED  !  'N$P !  {P "  "P #  #P $  $4 N4  < X , (  Xt(d 4\ame sysname = NULL, @operator_id INT = NULL AS BEGIN DECLARE @op   D c (AHlT`N4 restorefilegroup =  S0&H88 Srestore_history_idel 5  46H4restore_history_id > K0&HKfilegroup_nameLd 5 ,6H,filegroup_nameD  H  H/op`erD  c I/ERpE L  EH 8ZDL   EH  .oDa, HEcL  DH  > ~0RHDDE^~restorefilegroup  Hx8 @ R0*HU `N4 Rrestorefilegroup h   .6H.restorefilegroupCD !4 ! HD c (AlD6 g 0 jJ\ > !0lHjJ! D 9  HlD A  jJl l B n0*lF H`N4 nFK__restorefi__resto__17036CC0p  J6lJFK__restorefi__resto__17036CC0eD !  HlP   %P   P   P   4 `N4  D T  <|8(d,<\er_days, so.netsend_address, so.last_netsend_date, so.last_netsend_time, category0 @N4 grrev L 1  '- P     4 N4 d0J0X WHERE ((@operator_name IS NULL) OR (so.name = @operator_name)) AND ((@operator_id IS NULL) OR (so0 @N4 grrev L 1 j8 P     4 N4 d0J0XP &#  &# P &$  &$4 &0 @ N4 grrevXL  1 a D P      4  N4 d0J0XJ r`A%0J r%CREATE PROCEDURE sp_purgehistory @taskname sysname = NULL, -- Was VARCHAR(100) in 6.x @taskid INT r0 @!O4 grrev+L !1 }:@ P  !   4 !O4 d0J0Xor_namend 5t &,6/+,@operator_nameP 5 &/+#,(14P 50 @"O4 grrevL "1 .A P  "   4 "O4 d0J0XillP 5  5 /+0 obsP 5  5 /+0 T @P 5  50 @# O4 grrevL #1 s P  #   4 # O4 d0J0XA4 \sp_help_operator_jobsp 5> &86/+8sp_help_operator_jobsD 50 @$ O4 grrevL $1 i< P  $   4 $ O4 d0J0X id FROM msdb.dbo.sysoperators WHERE (name = @operator_name) IF (@operator_id IS NULL) BEGIN RAISERROR(14262, -1, -1, '@operator_name', @operator_name) RETURN(1) -- Failure END 0 @% O4 grrevnoL %1 DhF? P  %   4 % O4 d0J0X) OR ((notify_page_operator_id = @operator_id) AND (notify_level_page <> 0)) RETURN(0) -- Success END gP 5   &%P 0 @& O4 grrev L &1 EG P  &   4 & O4 d0J0Xt$4D@\rver_insertttD ! g0s l00slCREAT5-! 0 @'O4 grrev L '1 ~H P  '   4 'O4 d0J0Xnameves` ;Nf1&6h &@alert_name ;O ;K0&h 0 @(O4 grrev,L (1! I P  (   4 (O4 d0J0Xg ;86h 8@notification_method| ;O ;A0&h 88 A@alert_id 0 @)O4 grreviL )1" J P  )   4 )O4 d0J0Xtor_idP ; ; h v8 N'P ; ; ; h v8 P ;; 0 @*O4 grrevL *1# M P  *   4 *O4 d0J0XB4 ^sp_verify_notificationt ;B:6h :sp_verify_notification6D 0 @+O4 grrevL +1$  |O P  +   4 +O4 d0J0XOUTPUT, @operator_id INT OUTPUT AS BEGIN DECLARE @res_valid_range NVARCHAR(100) SET NOCOUNT ON SELECT @res_valid_range = FORMATMESSAGE(14208) -- Remove any leading/trailing spa0 @,O4 grrevraL ,1% FpP P  ,   4 ,O4 d0J0X262, 16, 1, '@alert_name', @alert_name) RETURN(1) -- Failure END -- Check if the OperatorName is valid SELECT @operator_id = id FROM msdb.dbo.sysoperators WHERE (name = @operator_name) 0 @- O4 grrev@oL -1& eQ P  -   4 - O4 d0J0Xname = N'MSXOperator') BEGIN RAISERROR(14251, -1, -1, @operator_name) RETURN(1) -- Failure END -- Check if the NotificationMethod is valid IF ((@notification_method < 1) OR (@notifica0 @.%O4 grrevliL .1' `MS P  .   4 .%O4 d0J0XP ;  ; P ;  ;4 ;B40 @/%O4 grrevVAL /1( *AT P  /   4 /%O4 d0J0X the format 'object|counter|instance|comparator|value' -- NOTE: 'instance' may be empty. IF (PATINDEX(N'%_|%_|%|[><=]|[0-9]%', @performance_condition) = 0) BEGIN RAISERROR(14507, 16, 1)i e; 0 @0)O4 grrevL 01) c5U P  0   4 0)O4 d0J0Xmeect` Dz &6+&@alert_name= DO+ DK0&+K0 @1)O4 grrev+L 11* W P  1   4 1)O4 d0J0X D86+8@notification_methodP D; ;+h , 'P D ; D 0 @2.O4 grrevL 21+ +\ P  2   4 2.O4 d0J0X D   --+\ T D; D(NO EX+\ P D; D+\ 0 @3.O4 grrevmeL 31, d] P  3   4 3.O4 d0J0X546+4sp_add_notificationD D! ; +H/mC4SplitNext0 @43O4 grrevL 41 "B P  4   4 43O4 d0J0XD' D/Ex80v% -- Displays views accessable to current user create view INFORMATION_SCHEMA.VIEWS as select db_name() as TABLE_CATALOG0 @53O4 grrevisL 51. 7_ P  5   4 53O4 d0J0Xere com2.id = obj.id and CHARINDEX('WITH CHECK OPTION', upper(com2.text)) > 0) then 'CASCADE' else 'NONE' end as CHECK_OPTION ,'NO' as IS_UPDATABLE from sysobjects obj ,sys0 @67O4 grrev L 61/ \` P  6   4 67O4 d0J0Xname() as VIEW_CATALOG ,user_name(v_obj.uid) as VIEW_SCHEMA ,v_obj.name as VIEW_NAME ,db_name() as TABLE_CATALOG ,user_name(t_obj.uid) as TABLE_SCHEMA ,t_obj.name as TABLE_NAME from 0 @7 1) 0 @;FO4 grrev L ;14 l P  ;   4 ;FO4 d0J0X @notification_method, @alert_id OUTPUT, @operator_id OUTPUT IF (@retval <> 0) 0 @<FO4 grrevunL <15 2 m P  <   4 <FO4 d0J0X AND (operator_id = @operator_id))) BEGIN SELECT @notification = @alert_name + N' / ' + @operator_name + N' / ' + CONVERT(NVARCHAR, @notification_method) RAISERROR(14261, 16, 1,0 @=JO4 grrevs_L =16 -Wn P  =   4 =JO4 d0J0Xon_method) VALUES (@alert_id, @operator_id, @notification_method) SELECT @retval = @@error SELECT @new_has_notification = has_notification FROM msdb.dbo.sysalerts W0 @>JO4 grrevifL >17 f{n P  >   4 >JO4 d0J0X @action_type = N'U' RETURN(@retval) -- 0 means success END P D   DP D!  D0 @?OO4 grrevL ?18 o P  ?   4 ?OO4 d0J0X8\P0*xuP 84 Psp_verify_alertd3,6xu,s!E@E o 0 @@OO4 grrevL @19 p P  @   4 @OO4 d0J0Xname @e` Tz  D&6O&@alert_nameme TO2 TK0&O0 @ATO4 grrev,L A1: q P  A   4 ATO4 d0J0X  T86O8@notification_methodP T; DOh resP T ; T0 @BTO4 grrevL B1; J r P  B   4 BTO4 d0J0X! T O\ IM(T T; T= L RIMO\ T T; Tven _deO0 @CXO4 grrevL C1 0 P  C   4 CXO4 d0J0X ;:6O:sp_update_notification D T! D OH/ID40 @DXO4 grrevL D14 I0j P  D   4 D]O4 d0J0XY'L TY D '> ( L T' DYD (-   @E]O4 grrevs P  E   4 E]O4 d0J0X as TABLE_CATALOG ,user_name(t_obj.uid) as TABLE_SCHEMA ,t_obj.name as TABLE_NAME ,db_name() as CONSTRAINT_CATALOG ,user_name(c_obj.uid) as CONSTRAINT_SCHEMA ,c_obj.name as CONSTRAINT_NAME from sysobjects c_obj ,sysobjects t_obj where t_obj.uid = user_id() 0 @FaO4 grrev1L F1 &n P  F   4 FaO4 d0L0XSTRAINT_CATALOG ,CONSTRAINT_SCHEMA ,CONSTRAINT_NAME ) as select KCU.TABLE_CATALOG /*TABLE_CATALOG*/ ,KCU.TABLE_SCHEMA /*TABLE_SCHEMA*/ ,KCU.TABLE_NAME /*TABLE_NAME*/ ,KCU.COLUMN_NAME /*COLU0 @GaO4 grrevNSL G1 iM P  G   4 GaO4 d0L0XABLE_NAME*/ ,cols.name /*COLUMN_NAME*/ ,db_name() /*CONSTRAINT_CATALOG*/ ,user_name(c_obj.uid)/*CONSTRAINT_SCHEMA*/ ,c_obj.name /*CONSTRAINT_NAME*/ from sysobjects t_obj ,sysobjects c_obj0 @HfO4 grrev aL H1  P  H   4 HfO4 d0L0X*COLUMN_NAME*/ ,db_name() /*CONSTRAINT_CATALOG*/ ,user_name(r_obj.uid) /*CONSTRAINT_SCHEMA*/ ,r_obj.name /*CONSTRAINT_NAME*/ FROM sysobjects t_obj ,syscolumns col ,systypes typ ,sysobjects 0 @IfO4 grrev.xL I1   P  I   4 IfO4 d0L0XO(T,P T   D$4 TND4 T0 T( Ti0 @JkO4 grrevysL J1 jJ P  J   4 JkO4 d0L0Xtification NVARCHAR(512) DECLARE @retval INT DECLARE @old_has_notification INT DECLARE @new_has_notification INT DECLARE @res_notification NVARCHAR(100) SET NOCOUNT0 @KkO4 grrevilL K1 ' P  K   4 KkO4 d0L0X 0) <> 1) BEGIN RAISERROR(15003, 16, 1, N'sysadmin') RETURN(1) -- Failure END -- Check if the Notification is valid EXECUTE sp_verify_notification @alert_name, 0 @LpO4 grrev L L1 H P  L   4 LpO4 d0L0Xications WHERE (alert_id = @alert_id) AND (operator_id = @operator_id))) BEGIN SELECT @notification = @alert_name + N' / ' + @operator_name RAISERROR(1426  <M-O4DMLEL M4 J0@O4O4IIJTargetServersRoleE d M, ,6@,TargetServersRole@ M7  @vaP  M   4 MO4 0|<TAgent of the change - if any - to has_notifications IF (@old_has_notification <> @new_has_notification) EXECUTE msdb.dbo.sp_sqlagent_notify @op_type = N'A', @alert_id = @alert_id, @action_type = N'U' RETURN(@retval) -- 0 means success END k iP T#   T!P T$  T$0 @NO4 grrevL N1 > @ P  N   4 NO4 d0]0X BEGIN DECLARE @message_id_as_char VARCHAR(10) SELECT @message_id_as_char = CONVERT(VARCHAR(10), @message_id) INSERT INTO #TempRetVal EXECUTE ('IF (' + @message_id_as_cf, O0r NaTS 0 @OO4 grrevL O1 "U@ P  O   4 OO4 d0]0Xname, 1` dz T&6t&@alert_name 0 dO; dK0&t0 @PO4 grrev,L P1 g@ P  P   4 PO4 d0]0X;) dt\ 16,P d ;) d tv8 EP d ;) d 0 @QO4 grrev L Q1# A%@ P  Q   4 QO4 d0]0X dt]!me dt4 d T^0*tP *E4 ^sp_delete_not0 @RO4 grrevL R1  @ P  R   4 RO4 d0]0Xete_notification @alert_name sysname, @operator_name sysname AS BEGIN DECLARE @alert_id INT DECLARE @operator_id INT DECLARE @ignored TINYINT DECLARE 0 @SO4 grrevd_L S13 J@ P  S   4 SO4 d0]0Xaces from parameters SELECT @alert_name = LTRIM(RTRIM(@alert_name)) SELECT @operator_name = LTRIM(RTRIM(@operator_name)) -- Only a sysadmin can do this IF (ISNULL(IS_SRVROLEMEMBER(N'sysadmin0 @TO4 grrevreL T18 eQ@ P  T   4 TO4 d0]0Xalue @alert_id OUTPUT, @operator_id OUTPUT -- Check if this notification exists IF (NOT EXISTS (SELECT * FROM0 @UO4 grrev L U1B Ha@ P  U   4 UO4 d0V0X SELECT @old_has_notification = has_notification FROM msdb.dbo.sysalerts WHERE (id = @alert_id) -- Do the Delete DELETE FROM msdb.dbo.sysnotifications WHERE (alert_id = @alert_id) AN0 @VO4 grrevicL V1C ,le@ P  V   4 VO4 d0V0XEXECUTE msdb.dbo.sp_sqlagent_notify @op_type = N'A', @alert_id = @alert_id, @action_type = N'U' RETURN(@ret0 @WO4 grrevL W1C wd@ P  W   4 WO4 d0V0X d4 d*E4 d́C0`p |\ dt$ <\Ba m)ni$ D c (A2TXBP4 sysdtscategoriesp X&70&7name@P XR 6name X E0&Edescription` R &6&descriptionl X 30&$$3idL XS 6idx X ?0&$$?parentidX  XU  6 parentidD   X J/t`fD   Xc  K/pL   XG 8ZFL   XG  .(F,  XGcL XF$ X>  ~0RFF$9 G^~sysdtscategoriesB Xx8 XD R0*U GP4 Rsysdtscategories4h X/ .6.sysdtscategoriesD X!7  D c (A2k@ Xx8XXH]0Hx8@9@x8S(]0x8$$@(]0]0x8tx8 ]0x8C@(]0]0d_]0[sysobjts]dQwx8x8Hx8%x x8x8`Axx8q%xx8%xx9bx8$x9bx8]0 ]0D/x8I`SX0x8`Y0S0^0x8cb0RF$G^~sysdtstegoriesx80l//@//d0x/x8X0>x8(X0 X0[Tx8]0(X0@X0[0uu|]0(]0 09 0]0`x8@]0, ]0]0|x8*@D]0x8HFF$9 G$$pk_dtscategories0RFF$9 G^~sysdtscategoriesg@/ l/XT0/dj/v7@/ lx8v^bx8Tx8^bC0x8f,bTx8,0DC//x8Dx8HbC8x80Wvj0,/x8cbC/X0,0C/x80,0x8)b,0d0x8jc,0x8Cx80<7x8x8Yvx8́C,0$x8t 0*R .28x8 Tx8v`x8hhhx8uv(x8px8x8$x8U XY/GP4"AllocMixedExtenthe8 Yc i I08  Yc tI4 YGP4 /D  X  L/ATO`S')D  Xc M/is pnlyL  XI 8ZHL  XI .geH , XIHc8  X H10D ! X N/re_`lauL " XI 4 SJOU8 #X !J08L D\<H(p$`Pp \object_type = UPPER(LTRIM(RTRIM(@object_type))) SELECT @name = LTRIM(RTRIM(@name)) U(X+  , $X L  XG .FIFecD  X "J`db. bo.8 c H ~0RFF$9 G^~sysdtscategoresBE X> 0RHHJ$9 Iv$$pk_dtscategoriesbo X> 0RHHJ$9 Iv$$pk_dtscategories- X> 0RHHJ$9 Iv$$pk_dtscategoriese  Xf, {TT  X>    WWo vTxsdbf,L  XD  @fom_  X  2 XF  R0*2PKLP4 Rpk_dtscategoriesSEh X .62.pk_dtscategories ND X!  2D c (Ak@ Xx8XXH]0!9@(.x8S(]0x8$$]0x8C@(]0]0d_]0[sysobjts]dQwx8x8Hx8%x x8x8`Axx8q%xx8%xx9bx8$x9bx8]0 ]0D/x8I`SX0x8`Y0S0^0x8cb0RF$G^~sysdtstegoriesx80l//@//d0x/x8X0>x8(X0 X0[Tx8x8///x8hx8x8x8/Ğ/Xx8fhx8x8/d0x8Ğ//x8whjd0x8gx8!(.$$$$uq_dtscategories_name_parent0RHHJ$9 Ix$$pk_dtscategoriesf,x8~-cjx8$x8[007x8#7x8KjHHJ9 I$$x8x8$x8pk_dtscategorU D  X O/ti`onD  Xc P/((pnoL  XL 8ZKL  XL .uK+, XLc8 X Ki, X P X>  $ )P X> ( l X> 0RKK!(.L$$$$uq_dtscategories_name_parent X> 0RKK!(.L$$$$uq_dtscategories_name_parent  X> 0RKK!(.L$$$$uq_dtscategories_name_parent. Xf-  TT  >   WWf-L !XD 8  / "X #Xk $XH "j0*kUQQP4 juq_dtscategories_name_parent/ %XT F6kFuq_dtscategores_name_parentD &X!  kP ' X P ( X ( P ) X )4 XQP4 hx80Td pdL4|PTHxP D TINYINT iX0,Xi <ZUP4DMLA ZH !0$øO7LocalDTS Packages stored on local SQL Serverl ZK 26øO2LocalP  Z> !4 ZUP4 ^00T;N INY NT v8P ;P \ tegL 1 m.0 AS \  \ D1 0 \    j0*TR\ G4 <[ZP4DML [H 0$øOARepositoryDTS Packages stored on Repositoryt [K <6øO<RepositoryP  [> 4 [ZP4 ^00Tsdb.dbo.sysnotifications WHERE (notification_method = 0) -- Reset the has_notification flag for the affected alerts UPDATE msdb.dbo.sysalerts SET has_notification = 0 FROM inserted i, msdb.dbo.sysalerts sa WHERE (i.alert_id = sa.id) -- Update sysalerts.has_notification (for email) UPDATE msdb.dbo.sysalerts SET has_notification = has_notification | 1 FROM msdb.dbo.sysalerts sa, msdb.dbo.sysnotifications sn, inserte. <\_P4DML \H 0$øOøOELocalDefaultDefault local subcategory for DTS Packages x \K @6øOøO@LocalDefaultP  \> 4 _P4 ^00(T SET has_notification = has_notification | 4 FROM msdb.dbo.sysalerts sa, msdb.dbo.sysnotifications sn, inserted i WHERE (sa.id = sn.alert_id) AND (sa.id = i.alert_id) AND ((sn.notification_method & 4) = 4) END d-cP    P   P  \@ L]P4update statsP ] *4 cot_ =P  ] 4 ]P4 x8dies WHERE (category_id = 98) END -- Map a job_id of 0 to the real value we use to mean 'no job' IF (@job_id = CONVERT(UNIQUEIDENTIFIER, 0x00)) AND (@job_name IS NULL) o s  v L^P4update statsd ^F 1BBL>>x<>x<BB@ !,7BMXcny)4?JU`kv&1<GR]hs~bbbbbP4aa ;1 ;_>:_>:,AA !,7BMXcny)4?JU`kv&1<GR]hs~ #9DOZep{  +6ALWbmx(3>IT_ju%0;FQ\gr} "-8CNYdoz *5@KValw   ' 2 = H S ^ i t     $ / : E P [ f q |  ! , 7 B M X c n y  \ ^ ""P4aa ;1 ;_>:_>:,AA !,7BMXcny)4JU`kv&1<GR]hs~ #.9DOZep{  +6ALWbmx(3>IT_ju%0;FQ\gr} "-8CNYdoz *5@KValw   ' 2 = H S ^ i t     $ / : E P [ f q |  ! , 7 B M X c n y  DL_/P4SpaceAllocD  _ J/ e`oL  _J4FL _F8x84 _P4 d0/P  ^ \  ^F ""P4aa ;1 ;_>:_>:,AA !,7BMXcny)4?JU`kv&1<GR]hs~ #.9DOZep{  +6ALWbmx(3>IT_ju%0;FQ\gr} "-8CNYdoz *5@KValw   ' 2 = H S ^ i t     $ / : E P [ f q |  ! , 7 B M X c n y  ra4  ^c Ja`,L p $ d -- Notify SQLServerAgent of the change SELECT @alert_id = id FROM msdb.dbo.sysalerts WHERE (name = @name) EXEC?. LJ4update stats  0Rv8` 88 _WA_Sys_severity_173876EAH f  f J4?? B  f TTfff fe    WWv8ҀnefP   4 J4 ,0x8@\dgw~xT:4sp_update_alert&t +'90&gw9@name?@T U1(6gw@namem| , Td pdL4|PTH,L p $ d