{"id":302,"date":"2013-08-27T01:45:28","date_gmt":"2013-08-27T01:45:28","guid":{"rendered":"http:\/\/www.theSQLReport.com\/?p=302"},"modified":"2014-08-15T10:51:57","modified_gmt":"2014-08-15T10:51:57","slug":"sp_readerrorlog-vs-xp_readerrorlog","status":"publish","type":"post","link":"https:\/\/www.theSQLReport.com\/?p=302","title":{"rendered":"sp_readerrorlog vs xp_readerrorlog"},"content":{"rendered":"<p><strong>Question: What is the difference between <span style=\"text-decoration: underline;\">sp_readerrorlog<\/span> and <span style=\"text-decoration: underline;\">xp_readerrorlog<\/span>?<\/strong><\/p>\n<p><strong>Executive Summary Answer:<\/strong> <strong>ALMOST NOTHING<\/strong><\/p>\n<p><strong>The More Detailed Answer:<\/strong> under the covers sp_readerrorlog is a stored procedure in the master database that checks that the user is part of the securityadmin group, then calls xp_readerrorlog, passing parameters if available.\u00a0 Any differences between the two procedures does not affect the output, which means the information returned is the same.<\/p>\n<p>When you run the following for sp_readerrlog:<\/p>\n<address style=\"padding-left: 30px;\"><span style=\"color: #333399;\">sp_helptext N&#8217;sp_readerrorlog&#8217;<\/span><\/address>\n<address style=\"padding-left: 30px;\"><span style=\"color: #333399;\">go<\/span><\/address>\n<p>\u00a0The result returned is:<\/p>\n<address style=\"padding-left: 60px;\"><span style=\"color: #333399;\">Text<\/span><\/address>\n<address style=\"padding-left: 60px;\"><span style=\"color: #333399;\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/span><\/address>\n<address style=\"padding-left: 60px;\"><span style=\"color: #333399;\">create proc sys.sp_readerrorlog(<\/span><\/address>\n<address style=\"padding-left: 60px;\"><span style=\"color: #333399;\">\u00a0\u00a0\u00a0 @p1\u00a0\u00a0\u00a0 int = 0,<\/span><\/address>\n<address style=\"padding-left: 60px;\"><span style=\"color: #333399;\">\u00a0\u00a0\u00a0 @p2\u00a0\u00a0\u00a0 int = NULL,<\/span><\/address>\n<address style=\"padding-left: 60px;\"><span style=\"color: #333399;\">\u00a0\u00a0\u00a0 @p3\u00a0\u00a0\u00a0 nvarchar(4000) = NULL,<\/span><\/address>\n<address style=\"padding-left: 60px;\"><span style=\"color: #333399;\">\u00a0\u00a0\u00a0 @p4\u00a0\u00a0\u00a0 nvarchar(4000) = NULL)<\/span><\/address>\n<address style=\"padding-left: 60px;\"><span style=\"color: #333399;\">as<\/span><\/address>\n<address style=\"padding-left: 60px;\"><span style=\"color: #333399;\">begin<\/span><\/address>\n<address style=\"padding-left: 60px;\">\u00a0\u00a0\u00a0\u00a0 <span style=\"color: #333399;\">if (not is_srvrolemember(N&#8217;securityadmin&#8217;) = 1)<\/span><\/address>\n<address style=\"padding-left: 60px;\">\u00a0\u00a0\u00a0<span style=\"color: #333399;\"> begin<\/span><\/address>\n<address style=\"padding-left: 60px;\">\u00a0\u00a0\u00a0 \u00a0\u00a0<span style=\"color: #333399;\"> raiserror(15003,-1,-1, N&#8217;securityadmin&#8217;)<\/span><\/address>\n<address style=\"padding-left: 60px;\">\u00a0\u00a0\u00a0 \u00a0\u00a0 <span style=\"color: #333399;\">return (1)<\/span><\/address>\n<address style=\"padding-left: 60px;\">\u00a0\u00a0\u00a0 <span style=\"color: #333399;\">end<\/span><\/address>\n<address style=\"padding-left: 60px;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: #333399;\">if (@p2 is NULL)<\/span><\/address>\n<address style=\"padding-left: 60px;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #333399;\"> exec sys.xp_readerrorlog @p1<\/span><\/address>\n<address style=\"padding-left: 60px;\">\u00a0\u00a0\u00a0 <span style=\"color: #333399;\">else<\/span><\/address>\n<address style=\"padding-left: 60px;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: #333399;\">exec sys.xp_readerrorlog @p1,@p2,@p3,@p4<\/span><\/address>\n<address style=\"padding-left: 60px;\"><span style=\"color: #333399;\">end<\/span><\/address>\n<p>\u00a0When you run the following for xp_readerrlog:<\/p>\n<address style=\"padding-left: 30px;\"><span style=\"color: #333399;\">sp_helptext N&#8217;xp_readerrorlog&#8217;<\/span><\/address>\n<address style=\"padding-left: 30px;\"><span style=\"color: #333399;\">go<\/span><\/address>\n<address style=\"padding-left: 30px;\">\u00a0<\/address>\n<address style=\"padding-left: 30px;\">The result returned is:<\/address>\n<address style=\"padding-left: 30px;\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-308 aligncenter\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/08\/xpstar.dll_.jpg\" alt=\"xp_readerrorlog\" width=\"691\" height=\"198\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/08\/xpstar.dll_.jpg 691w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/08\/xpstar.dll_-300x85.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2013\/08\/xpstar.dll_-210x60.jpg 210w\" sizes=\"(max-width: 691px) 100vw, 691px\" \/><\/address>\n<p>The\u00a0xpstar.dll library file is a module that stores extended stored procedures for SQL Server.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Question: What is the difference between sp_readerrorlog and xp_readerrorlog? Executive Summary Answer: ALMOST NOTHING The More Detailed Answer: under the covers sp_readerrorlog is a stored procedure in the master database &hellip; <a class=\"readmore\" href=\"https:\/\/www.theSQLReport.com\/?p=302\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":308,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-302","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sql-server"],"_links":{"self":[{"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/302"}],"collection":[{"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=302"}],"version-history":[{"count":14,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/302\/revisions"}],"predecessor-version":[{"id":727,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/302\/revisions\/727"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/media\/308"}],"wp:attachment":[{"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=302"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=302"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=302"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}