<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>nlsimmons.com &#187; SQL Server Agent</title>
	<atom:link href="http://nlsimmons.com/?cat=8&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://nlsimmons.com</link>
	<description>Professional Blog &#38; Online Resume</description>
	<lastBuildDate>Wed, 10 Jun 2015 15:02:01 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.2.2</generator>
	<item>
		<title>Msg 14274, Level 16, State 1, Procedure sp_add_job</title>
		<link>http://nlsimmons.com/?p=152</link>
		<comments>http://nlsimmons.com/?p=152#comments</comments>
		<pubDate>Wed, 13 Oct 2010 22:47:21 +0000</pubDate>
		<dc:creator><![CDATA[]]></dc:creator>
				<category><![CDATA[SQL Server Agent]]></category>

		<guid isPermaLink="false">http://nlsimmons.com/SQLScraps/?p=152</guid>
		<description><![CDATA[Cannot add, update, or delete a job (or its steps or schedules) that originated from an MSX server. Recently I&#8230;]]></description>
				<content:encoded><![CDATA[            <script type="text/javascript" src="http://nlsimmons.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushSql.js"></script>
<h3>Cannot add, update, or delete a job (or its steps or schedules) that originated from an MSX server.</h3>
<p>Recently I ran into this error on an instance of SQL Server 2005.  There are several articles and blog posts concerning this error on SQL Server 2000 systems, but next to none that discuss the error in SQL Server 2005.  For a list of all of the procedures in MSDB that can throw this error, execute the following query:</p>
<p><pre class="brush: sql">SELECT name 
FROM sys.procedures
WHERE
OBJECT_DEFINITION(OBJECT_ID(name)) LIKE '%RAISERROR(14274%'</pre></p>
<p>In my case, the error came from msdb.dbo.sp_add_job.  To figure out what was causing the error, take a look at the procedure code:</p>
<p><pre class="brush: sql">USE [MSDB]
GO

EXEC sp_helptext sp_add_job;</pre></p>
<p>Do a search for &#8216;RAISERROR(14274&#8242; and you&#8217;ll see the logic that is causing the error.  In the case of sp_add_job, the logic is:</p>
<p><pre class="brush: sql">IF (@job_id IS NULL)
  BEGIN
    -- Assign the GUID
    SELECT @job_id = NEWID()
  END
  ELSE
  BEGIN
    -- A job ID has been provided, so check that the caller is SQLServerAgent (inserting an MSX job)
    IF (PROGRAM_NAME() NOT LIKE N'SQLAgent%')
    BEGIN
      RAISERROR(14274, -1, -1)
      RETURN(1) -- Failure
    END
  END</pre></p>
<p>Here we see that if a non-NULL value for @job_id is passed into sp_add_job from somewhere other than a SQL Agent Job step (e.g. SSMS), you&#8217;ll get the 14274 error.</p>
<p>I hope this helps someone out there!</p>
]]></content:encoded>
			<wfw:commentRss>http://nlsimmons.com/?feed=rss2&#038;p=152</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
