{"id":984,"date":"2012-05-27T09:41:34","date_gmt":"2012-05-27T13:41:34","guid":{"rendered":"http:\/\/sqlity.net\/en\/?p=984"},"modified":"2014-11-13T13:57:20","modified_gmt":"2014-11-13T18:57:20","slug":"print-vs-raiserror","status":"publish","type":"post","link":"https:\/\/sqlity.net\/en\/984\/print-vs-raiserror\/","title":{"rendered":"PRINT vs. RAISERROR"},"content":{"rendered":"<div>\n<h3>Introduction<\/h3>\n<p>\nDid you know that the <span class=\"tt\">RAISERROR<\/span> command can be used as a powerful <span class=\"tt\">PRINT<\/span> alternative?<br \/>\nIn this article I am going to compare the two and show the advantages that <span class=\"tt\">RAISERROR<\/span> offers over <span class=\"tt\">PRINT<\/span>.\n<\/p>\n<h3>Print Lags<\/h3>\n<p>\nOne of the bigger disadvantages of <span class=\"tt\">PRINT<\/span> is its output buffering behavior. Let's look at an example to clarify what I mean by that:\n<\/p>\n<div>\n[sql]\nDECLARE @c INT;SET @c = 1;<br \/>\nWHILE(@c&lt;100)<br \/>\nBEGIN<br \/>\n   PRINT @c;<br \/>\n   SET @c = @c + 1;<br \/>\n   WAITFOR DELAY '00:00:00.2'<br \/>\nEND<br \/>\n[\/sql]\n<\/div>\n<p>\nThis loop prints out an increasing counter value, waiting for 0.2 seconds after each print. It runs for about 40 iterations before any output is generated. Then it waits for another ~40 iterations before the next block of output is returned to the client, and so on. You can observe this behavior in the following video:\n<\/p>\n<p>\n<a href=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/PRINT_with_buffering_delay.gif\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/PRINT_with_buffering_delay.gif\" alt=\"PRINT with buffering delay\" title=\"PRINT with buffering delay\" width=\"800\" height=\"600\" class=\"aligncenter size-full wp-image-986\" srcset=\"https:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/PRINT_with_buffering_delay.gif 800w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/PRINT_with_buffering_delay-300x225.gif 300w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a>\n<\/p>\n<p>\nSQL Server does not allow for any interactivity within batches, so printing is the only feedback mechanism available. In almost all cases it is used to inform about the current state of the execution which might even include warnings. This feedback mechanism is of reduced value, if you can't rely on it happening in real-time.\n<\/p>\n<h3>Real-Time RAISERROR<\/h3>\n<p>\nIn its standard form, <span class=\"tt\">RAISERROR<\/span> shows the same buffering behavior. However, there is a little known option <span class=\"tt\">NOWAIT<\/span> that causes the output buffer to get flushed immediately. That makes it usable for real-time feedback:\n <\/p>\n<p>\n<a href=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/RAISERROR_with_NOWAIT_option.gif\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/RAISERROR_with_NOWAIT_option.gif\" alt=\"RAISERROR with NOWAIT option\" title=\"RAISERROR with NOWAIT option\" width=\"800\" height=\"600\" class=\"aligncenter size-full wp-image-989\" srcset=\"https:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/RAISERROR_with_NOWAIT_option.gif 800w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/RAISERROR_with_NOWAIT_option-300x225.gif 300w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a>\n<\/p>\n<p>\nThe disadvantage of using <span class=\"tt\">RAISERROR<\/span> in this way is that it outputs an additional error information line with each call  and that at least in Management Studio the output is displayed in red. This can make it hard to find the actual information in all the output clutter. But there is a way to get rid of that too.\n<\/p>\n<h3>The Printing RAISERROR<\/h3>\n<p>\nWhen <span class=\"tt\">RAISERROR<\/span> is called with a severity between 1 and 9, the output loses its red color but it still contains that extra line, only this time after the printed message instead of before. If you however call <span class=\"tt\">RAISERROR<\/span> with a severity of 0 or 10 it behaves just like the print statement:\n<\/p>\n<div>\n[sql]\nDECLARE @c INT;SET @c = 1;<br \/>\nWHILE(@c&lt;10)<br \/>\nBEGIN<br \/>\n   RAISERROR('test',0,1)WITH NOWAIT;<br \/>\n   SET @c = @c + 1;<br \/>\n   WAITFOR DELAY '00:00:01'<br \/>\nEND<br \/>\n[\/sql]\n<\/div>\n<p>\nWhen you execute this code you get print behavior without print lag:\n<\/p>\n<p>\n<a href=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/RAISERROR_as_PRINT.gif\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/RAISERROR_as_PRINT.gif\" alt=\"RAISERROR as PRINT\" title=\"RAISERROR as PRINT\" width=\"800\" height=\"600\" class=\"aligncenter size-full wp-image-987\" srcset=\"https:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/RAISERROR_as_PRINT.gif 800w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/RAISERROR_as_PRINT-300x225.gif 300w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a>\n<\/p>\n<h3>The curious 17<\/h3>\n<p>\nThere is actually one exception to the buffering rule that you need to be aware of: When <span class=\"tt\">RAISERROR<\/span> is executed with a severity of 17, the output is held in a separate output buffer and returned after the batch finishes execution, even if the <span class=\"tt\">NOWAIT<\/span> option is specified.\n<\/p>\n<p>\nTo show this behavior, the following code alternatingly calls <span class=\"tt\">RAISERROR<\/span> with a severity of 16 and 17.\n<\/p>\n<div>\n[sql]\nDECLARE @c INT;SET @c = 0;<br \/>\nWHILE(@c&lt;10)<br \/>\nBEGIN<br \/>\n   DECLARE @s INT;SET @s = 16+@c%2;<br \/>\n   DECLARE @m NVARCHAR(MAX); SET @m = CAST(@c AS NVARCHAR(MAX));<br \/>\n   RAISERROR(@m,@s,10)WITH NOWAIT;<br \/>\n   SET @c = @c + 1;<br \/>\n   WAITFOR DELAY '00:00:01'<br \/>\nEND<br \/>\n[\/sql]\n<\/div>\n<p>\nExecuting above code produces this output:\n<\/p>\n<p>\n<a href=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/RAISERROR_with_severity_17.gif\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/RAISERROR_with_severity_17.gif\" alt=\"RAISERROR with a severity of 17\" title=\"RAISERROR with a severity of 17\" width=\"800\" height=\"600\" class=\"aligncenter size-full wp-image-993\" srcset=\"https:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/RAISERROR_with_severity_17.gif 800w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/RAISERROR_with_severity_17-300x225.gif 300w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a>\n<\/p>\n<p>\nThe same behavior can also be observed when using a severity of 18.\n<\/p>\n<h3>Shortcomings<\/h3>\n<p>\nNow there is one disadvantage that I don't want to hide. While you can pass a variable to <span class=\"tt\">RAISERROR<\/span> you cannot execute any calculations within its arguments. That includes something as simple as casting an integer to a string. <span class=\"tt\">PRINT<\/span> on the other hand is able to take anything you throw at it:\n<\/p>\n<p>\n<a href=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/RAISERROR_cannot_handle_CAST.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/RAISERROR_cannot_handle_CAST.png\" alt=\"RAISERROR cannot handle function calls\" title=\"RAISERROR cannot handle function calls\" width=\"800\" height=\"600\" class=\"aligncenter size-full wp-image-988\" srcset=\"https:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/RAISERROR_cannot_handle_CAST.png 800w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/RAISERROR_cannot_handle_CAST-300x225.png 300w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a>\n<\/p>\n<p>\nTo alleviate this a little, <span class=\"tt\">RAISERROR<\/span> allows to use the C-style <span class=\"tt\">prinf<\/span> syntax:\n<\/p>\n<div>\n[sql]\nDECLARE @int INT;SET @int = -1-POWER(-2,31);<br \/>\nDECLARE @bigint BIGINT;SET @bigint = -1-POWER(CAST(-2 AS BIGINT),63);<br \/>\nDECLARE @nvarchar NVARCHAR(MAX);<br \/>\nSET @nvarchar = '{This is a string in braces!}';<\/p>\n<p>RAISERROR('INT:%d, BIGINT:%I64d, string:%s',0,1,@int,@bigint,@nvarchar);<br \/>\n[\/sql]\n<\/p><\/div>\n<p>\nExecuting the above batch produces this output:\n<\/p>\n<p>\n<a href=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/RAISERROR_with_parameter_substitution.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/RAISERROR_with_parameter_substitution.png\" alt=\"RAISERROR with parameter substitution\" title=\"RAISERROR with parameter substitution\" width=\"800\" height=\"600\" class=\"aligncenter size-full wp-image-990\" srcset=\"https:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/RAISERROR_with_parameter_substitution.png 800w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/RAISERROR_with_parameter_substitution-300x225.png 300w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a>\n<\/p>\n<p>\nThis does not cover all cases, though. Printing out a timestamp using the <span class=\"tt\">SYSDATETIME()<\/span> function for example requires you to cast the <span class=\"tt\">DATETIME2<\/span> value to a string. That cannot be done inside the call to <span class=\"tt\">RAISERROR<\/span> so you have to store the result of that conversion in a <span class=\"tt\">VARCHAR<\/span> variable and then pass that to the <span class=\"tt\">RAISERROR<\/span> statement.\n<\/p>\n<p>\nBesides of that, this substitution syntax is actually quite powerful. It allows specifying a fixed length for each substitution value. You can set a precision for numbers and you can request that a number gets displayed as hex- or octal-value. Have a look at the BOL entry for details: <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms178592.aspx\">RAISERROR (Transact-SQL)<\/a> .\n<\/p>\n<h3>Conclusion<\/h3>\n<p>\nWhile <span class=\"tt\">RAISERROR<\/span> is not as flexible as <span class=\"tt\">PRINT<\/span> when looking at possible parameter values, it has the great advantage that you can use it to control output buffer behavior. That makes it the preferred choice when the output is used to give feedback about the state of the currently executing SQL batch.\n<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\nThis article shows a way to use RAISERROR as a PRINT alternative. It also explains in which situations it might be the preferred choice.\n<\/p>\n<p> <a href=\"https:\/\/sqlity.net\/en\/984\/print-vs-raiserror\/\">[more&#8230;]<\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5,23],"tags":[],"class_list":["post-984","post","type-post","status-publish","format-standard","hentry","category-general","category-t-sql-statements"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>PRINT vs. RAISERROR - sqlity.net<\/title>\n<meta name=\"description\" content=\"This article shows a way to use RAISERROR as a PRINT alternative. It also explains in which situations it might be the preferred choice.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/sqlity.net\/en\/984\/print-vs-raiserror\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PRINT vs. RAISERROR - sqlity.net\" \/>\n<meta property=\"og:description\" content=\"This article shows a way to use RAISERROR as a PRINT alternative. It also explains in which situations it might be the preferred choice.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/sqlity.net\/en\/984\/print-vs-raiserror\/\" \/>\n<meta property=\"og:site_name\" content=\"sqlity.net\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/sqlity.net\" \/>\n<meta property=\"article:published_time\" content=\"2012-05-27T13:41:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-11-13T18:57:20+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/PRINT_with_buffering_delay.gif\" \/>\n<meta name=\"author\" content=\"Sebastian Meine\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@sqlity\" \/>\n<meta name=\"twitter:site\" content=\"@sqlity\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sebastian Meine\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/984\\\/print-vs-raiserror\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/984\\\/print-vs-raiserror\\\/\"},\"author\":{\"name\":\"Sebastian Meine\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#\\\/schema\\\/person\\\/bcffd8c572bc2f1bd10fdba80135e53c\"},\"headline\":\"PRINT vs. RAISERROR\",\"datePublished\":\"2012-05-27T13:41:34+00:00\",\"dateModified\":\"2014-11-13T18:57:20+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/984\\\/print-vs-raiserror\\\/\"},\"wordCount\":828,\"commentCount\":1,\"image\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/984\\\/print-vs-raiserror\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/sqlity.net\\\/wp-content\\\/uploads\\\/2012\\\/05\\\/PRINT_with_buffering_delay.gif\",\"articleSection\":[\"General\",\"T-SQL Statements\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/sqlity.net\\\/en\\\/984\\\/print-vs-raiserror\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/984\\\/print-vs-raiserror\\\/\",\"url\":\"https:\\\/\\\/sqlity.net\\\/en\\\/984\\\/print-vs-raiserror\\\/\",\"name\":\"PRINT vs. RAISERROR - sqlity.net\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/984\\\/print-vs-raiserror\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/984\\\/print-vs-raiserror\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/sqlity.net\\\/wp-content\\\/uploads\\\/2012\\\/05\\\/PRINT_with_buffering_delay.gif\",\"datePublished\":\"2012-05-27T13:41:34+00:00\",\"dateModified\":\"2014-11-13T18:57:20+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#\\\/schema\\\/person\\\/bcffd8c572bc2f1bd10fdba80135e53c\"},\"description\":\"This article shows a way to use RAISERROR as a PRINT alternative. It also explains in which situations it might be the preferred choice.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/984\\\/print-vs-raiserror\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/sqlity.net\\\/en\\\/984\\\/print-vs-raiserror\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/984\\\/print-vs-raiserror\\\/#primaryimage\",\"url\":\"http:\\\/\\\/sqlity.net\\\/wp-content\\\/uploads\\\/2012\\\/05\\\/PRINT_with_buffering_delay.gif\",\"contentUrl\":\"http:\\\/\\\/sqlity.net\\\/wp-content\\\/uploads\\\/2012\\\/05\\\/PRINT_with_buffering_delay.gif\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/984\\\/print-vs-raiserror\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/sqlity.net\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PRINT vs. RAISERROR\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/sqlity.net\\\/en\\\/\",\"name\":\"sqlity.net\",\"description\":\"Quality for SQL\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/sqlity.net\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#\\\/schema\\\/person\\\/bcffd8c572bc2f1bd10fdba80135e53c\",\"name\":\"Sebastian Meine\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g\",\"caption\":\"Sebastian Meine\"},\"sameAs\":[\"http:\\\/\\\/sqlity.net\",\"https:\\\/\\\/x.com\\\/sqlity\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PRINT vs. RAISERROR - sqlity.net","description":"This article shows a way to use RAISERROR as a PRINT alternative. It also explains in which situations it might be the preferred choice.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/sqlity.net\/en\/984\/print-vs-raiserror\/","og_locale":"en_US","og_type":"article","og_title":"PRINT vs. RAISERROR - sqlity.net","og_description":"This article shows a way to use RAISERROR as a PRINT alternative. It also explains in which situations it might be the preferred choice.","og_url":"https:\/\/sqlity.net\/en\/984\/print-vs-raiserror\/","og_site_name":"sqlity.net","article_publisher":"https:\/\/www.facebook.com\/sqlity.net","article_published_time":"2012-05-27T13:41:34+00:00","article_modified_time":"2014-11-13T18:57:20+00:00","og_image":[{"url":"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/PRINT_with_buffering_delay.gif","type":"","width":"","height":""}],"author":"Sebastian Meine","twitter_card":"summary_large_image","twitter_creator":"@sqlity","twitter_site":"@sqlity","twitter_misc":{"Written by":"Sebastian Meine","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/sqlity.net\/en\/984\/print-vs-raiserror\/#article","isPartOf":{"@id":"https:\/\/sqlity.net\/en\/984\/print-vs-raiserror\/"},"author":{"name":"Sebastian Meine","@id":"https:\/\/sqlity.net\/en\/#\/schema\/person\/bcffd8c572bc2f1bd10fdba80135e53c"},"headline":"PRINT vs. RAISERROR","datePublished":"2012-05-27T13:41:34+00:00","dateModified":"2014-11-13T18:57:20+00:00","mainEntityOfPage":{"@id":"https:\/\/sqlity.net\/en\/984\/print-vs-raiserror\/"},"wordCount":828,"commentCount":1,"image":{"@id":"https:\/\/sqlity.net\/en\/984\/print-vs-raiserror\/#primaryimage"},"thumbnailUrl":"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/PRINT_with_buffering_delay.gif","articleSection":["General","T-SQL Statements"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/sqlity.net\/en\/984\/print-vs-raiserror\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/sqlity.net\/en\/984\/print-vs-raiserror\/","url":"https:\/\/sqlity.net\/en\/984\/print-vs-raiserror\/","name":"PRINT vs. RAISERROR - sqlity.net","isPartOf":{"@id":"https:\/\/sqlity.net\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/sqlity.net\/en\/984\/print-vs-raiserror\/#primaryimage"},"image":{"@id":"https:\/\/sqlity.net\/en\/984\/print-vs-raiserror\/#primaryimage"},"thumbnailUrl":"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/PRINT_with_buffering_delay.gif","datePublished":"2012-05-27T13:41:34+00:00","dateModified":"2014-11-13T18:57:20+00:00","author":{"@id":"https:\/\/sqlity.net\/en\/#\/schema\/person\/bcffd8c572bc2f1bd10fdba80135e53c"},"description":"This article shows a way to use RAISERROR as a PRINT alternative. It also explains in which situations it might be the preferred choice.","breadcrumb":{"@id":"https:\/\/sqlity.net\/en\/984\/print-vs-raiserror\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/sqlity.net\/en\/984\/print-vs-raiserror\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/sqlity.net\/en\/984\/print-vs-raiserror\/#primaryimage","url":"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/PRINT_with_buffering_delay.gif","contentUrl":"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/05\/PRINT_with_buffering_delay.gif"},{"@type":"BreadcrumbList","@id":"https:\/\/sqlity.net\/en\/984\/print-vs-raiserror\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/sqlity.net\/en\/"},{"@type":"ListItem","position":2,"name":"PRINT vs. RAISERROR"}]},{"@type":"WebSite","@id":"https:\/\/sqlity.net\/en\/#website","url":"https:\/\/sqlity.net\/en\/","name":"sqlity.net","description":"Quality for SQL","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/sqlity.net\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/sqlity.net\/en\/#\/schema\/person\/bcffd8c572bc2f1bd10fdba80135e53c","name":"Sebastian Meine","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g","caption":"Sebastian Meine"},"sameAs":["http:\/\/sqlity.net","https:\/\/x.com\/sqlity"]}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2wXuw-fS","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/posts\/984","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/comments?post=984"}],"version-history":[{"count":0,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/posts\/984\/revisions"}],"wp:attachment":[{"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/media?parent=984"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/categories?post=984"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/tags?post=984"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}