{"id":8777,"date":"2023-09-25T06:19:00","date_gmt":"2023-09-25T04:19:00","guid":{"rendered":"https:\/\/expert-only.com\/?p=8777"},"modified":"2023-11-10T14:04:12","modified_gmt":"2023-11-10T13:04:12","slug":"alter-sql-server-stored-procedure","status":"publish","type":"post","link":"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/","title":{"rendered":"How To Alter A SQL Server Stored Procedure ?"},"content":{"rendered":"\n<p><strong><em>T-SQL script example to alter an existing  SQL Server stored procedure using ALTER PROCEDURE.<\/em><\/strong><\/p>\n\n\n\n<p>How to alter a SQL Server stored procedure already in a Microsoft database ? Simply use the alter procedure command instead of the create command to modify an existing SQL procedure. In this example let&#8217;s add the grouping on months and employees to sum up and group the data. Let&#8217;s also add a sorting option to have the Sales figures by descending amounts.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 ez-toc-wrap-center counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/#video-tutorial-to-create-and-alter-a-sql-procedure\" >Video tutorial to Create and Alter a SQL Procedure<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/#original-t-sql-procedure-to-modify\" >Original T-SQL procedure to modify<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/#t-sql-script-to-alter-a-procedure\" >T-SQL script to Alter a Procedure<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/#enhance-the-stored-procedure-with-a-return-value\" >Enhance the Stored Procedure with a Return Value<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/#conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-video-tutorial-to-create-and-alter-a-sql-procedure\"><span class=\"ez-toc-section\" id=\"video-tutorial-to-create-and-alter-a-sql-procedure\"><\/span>Video tutorial to Create and Alter a SQL Procedure<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The video contains the same concepts from the blog post, but with simpler code examples.<\/p>\n\n\n\n<div style=\"text-align: center;\">\n<iframe loading=\"lazy\" width=\"426\" height=\"240\" src=\"https:\/\/www.youtube.com\/embed\/B_Y5lUeumoQ?si=z_OXCzgLEEijW4cp&amp;controls=0\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-original-t-sql-procedure-to-modify\"><span class=\"ez-toc-section\" id=\"original-t-sql-procedure-to-modify\"><\/span>Original T-SQL procedure to modify<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>This is the original script to create the stored procedure: <\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">CREATE PROCEDURE uspListSales\nAS\n\tSELECT *\n\tFROM dbo.SALES;\nGO<\/pre>\n\n\n\n<p>And the original table used above is created using the following T-SQL script: <\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">CREATE TABLE [dbo].[SALES] \n(\n\t[Year] INT, \n\t[MonthName] NVARCHAR(50), \t-- alphanumeric\n\t[MonthCurrent] BIT, \t\t-- Boolean\n\t[NumberMonth] TINYINT, \t\t-- very small integer\n\t[EmployeeNumber] SMALLINT, \t-- small integer\n\t[NumberOfClients] INTEGER, \t-- integer\n\t[NumberOfSales] BIGINT, \t\t-- big integer\n\t[Amount_ET] NUMERIC(15,5), \t-- numeric\n\t[Amount_IT] DECIMAL(15,5) \t-- decimal\n);<\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2023\/09\/create_alter_stored_procedure_laptop_1280_720-1024x576.jpg\" alt=\"Step by step tutorial to create and modify a stored procedure using an ALTER PROCEDURE query\" class=\"wp-image-28953\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2023\/09\/create_alter_stored_procedure_laptop_1280_720-1024x576.jpg 1024w, https:\/\/expert-only.com\/wp-content\/uploads\/2023\/09\/create_alter_stored_procedure_laptop_1280_720-300x169.jpg 300w, https:\/\/expert-only.com\/wp-content\/uploads\/2023\/09\/create_alter_stored_procedure_laptop_1280_720-768x432.jpg 768w, https:\/\/expert-only.com\/wp-content\/uploads\/2023\/09\/create_alter_stored_procedure_laptop_1280_720.jpg 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><em>Step by step tutorial to create and modify a stored procedure using an ALTER PROCEDURE query<\/em><\/figcaption><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-t-sql-script-to-alter-a-procedure\"><span class=\"ez-toc-section\" id=\"t-sql-script-to-alter-a-procedure\"><\/span>T-SQL script to Alter a Procedure<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>This T-SQL command modify the existing <em>uspListSales<\/em> stored procedure to get the sales for a given customer and to get the figures sorted by amounts from the more important to the less important one.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">ALTER PROCEDURE uspListSales\nAS\n\tSELECT \t\n\t\tMonthName, \n\t\tEmployeeNumber, \n\t\tSUM(NumberOfSales) \tAS SumNumberOfSales,\n\t\tSUM(AmountIT)\t\tAS SumAmountIT\nFROM dbo.SALES\nGROUP BY \tMonthName,\n\t\tEmployeeNumber\nORDER BY \tSUM(AmountIT) DESC\nGO\n<\/pre>\n\n\n\n<p>This command will modify the exiting object in order now to display the month name, the employee number, the total number of sales as well as total amount of sales including taxes.<\/p>\n\n\n\n<p>The changes made to the stored <a href=\"https:\/\/dictionary.cambridge.org\/dictionary\/english\/procedure\" target=\"_blank\" rel=\"noreferrer noopener\">procedure<\/a> also sort the lines returned based on the total sales amounts in descending order. It means from the biggest sales amount to the smallest. And the total sales are grouped by month name and Employee number.  <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-enhance-the-stored-procedure-with-a-return-value\"><span class=\"ez-toc-section\" id=\"enhance-the-stored-procedure-with-a-return-value\"><\/span>Enhance the Stored Procedure with a Return Value<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>A stored procedure in SQL Server can return an integer value to the calling environment, which can be extremely useful for indicating the status of the execution or the outcome of the operations carried out within the procedure. Now let&#8217;s modify the uspListSales stored procedure to include a return value that indicates the success or failure of the procedure execution.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-include-a-return-value-in-the-sql-server-procedure\">Include a return value in the SQL Server procedure<\/h3>\n\n\n\n<p>To <a href=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-stored-procedure-parameters\/\"><strong>include a return value in the stored procedure<\/strong><\/a>, we need to declare a variable that will hold the status code and ensure that we end the procedure with a RETURN statement, which provides the value back to the caller.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">ALTER PROCEDURE uspListSales\n   @CustomerID INT,\n   @StatusCode INT OUTPUT\nAS\nBEGIN\n   BEGIN TRY\n      -- Perform the grouped and sorted sales data retrieval\n      SELECT    \n         MonthName, \n         EmployeeNumber, \n         SUM(NumberOfSales) AS SumNumberOfSales,\n         SUM(Amount_IT) AS SumAmountIT\n      FROM dbo.SALES\n      WHERE CustomerID = @CustomerID  -- Assuming there is a CustomerID field\n      GROUP BY MonthName, EmployeeNumber\n      ORDER BY SUM(Amount_IT) DESC\n\n      -- If the query is successful, set the StatusCode to 0\n      SET @StatusCode = 0\n   END TRY\n   BEGIN CATCH\n      -- If an error occurs, set the StatusCode to the error number\n      SET @StatusCode = ERROR_NUMBER()\n   END CATCH\n\n   RETURN @StatusCode\nEND\nGO\n<\/pre>\n\n\n\n<p>In this enhanced version of the <em>uspListSales <\/em>stored procedure, we introduced :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A parameter @CustomerID to filter the sales by customer<\/li>\n\n\n\n<li>An output parameter @StatusCode to capture the success or error status.<\/li>\n\n\n\n<li>The TRY \u2026 CATCH block is utilized to handle any errors that may occur during the execution of the procedure.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-manage-the-errors-with-a-try-catch-block\">Manage the errors with a TRY CATCH block<\/h3>\n\n\n\n<p>Using this error management technique, we have 2 different cases managed here: <\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>If the SELECT statement executes without any issues, the @StatusCode is set to 0, indicating success.<\/li>\n\n\n\n<li>If an error occurs, the catch block captures the error number and sets it as the @StatusCode.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\"><span class=\"ez-toc-section\" id=\"conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Modifying a SQL Server stored procedure using the ALTER PROCEDURE command is a straightforward task that can significantly enhance the functionality and efficiency of your database operations.<\/p>\n\n\n\n<p>As explained and illustrated using the code, we can extend the capabilities of a stored procedure to not only perform more complex data retrieval and sorting operations but also to communicate execution status through a return value.<\/p>\n\n\n\n<p>Implementing such best practices in database development can aid in creating robust, reliable, and scalable database applications. Now, to go further in the T-SQL learning journey, read this short tutorial about <strong><a href=\"https:\/\/expert-only.com\/en\/t-sql\/how-to-create-a-sql-server-function\/\">how to create a SQL Server function<\/a><\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-embed aligncenter is-type-wp-embed is-provider-sql-and-it-tutorials wp-block-embed-sql-and-it-tutorials\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"VO7rTZK90U\"><a href=\"https:\/\/expert-only.com\/en\/t-sql\/delete-a-sql-server-function\/\">How to delete a SQL Server function with a script ?<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;How to delete a SQL Server function with a script ?&#8221; &#8212; SQL and IT Tutorials\" src=\"https:\/\/expert-only.com\/en\/t-sql\/delete-a-sql-server-function\/embed\/#?secret=pDLKYd3OAt#?secret=VO7rTZK90U\" data-secret=\"VO7rTZK90U\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>T-SQL script example to alter an existing SQL Server stored procedure using ALTER PROCEDURE. How to alter a SQL Server stored procedure already in a Microsoft database ? Simply use the alter procedure command instead of the create command <a class=\"mh-excerpt-more\" href=\"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/\" title=\"How To Alter A SQL Server Stored Procedure ?\">&#8230;<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":28953,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[454],"tags":[626],"class_list":{"0":"post-8777","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-t-sql","8":"tag-alter"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.7 (Yoast SEO v26.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How To Alter A SQL Server Stored Procedure ? T-SQL<\/title>\n<meta name=\"description\" content=\"To modify an existing SQL Server stored procedure in a database, execute a simple ALTER PROCEDURE statement to modify the code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Alter A SQL Server Stored Procedure ?\" \/>\n<meta property=\"og:description\" content=\"To modify an existing SQL Server stored procedure in a database, execute a simple ALTER PROCEDURE statement to modify the code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/\" \/>\n<meta property=\"og:site_name\" content=\"SQL and IT Tutorials\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ExpertOnlyCom\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-09-25T04:19:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-10T13:04:12+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/expert-only.com\/wp-content\/uploads\/2023\/09\/create_alter_stored_procedure_laptop_1280_720.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Expert-Only\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@expert_only\" \/>\n<meta name=\"twitter:site\" content=\"@expert_only\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Expert-Only\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/\"},\"author\":{\"name\":\"Expert-Only\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\"},\"headline\":\"How To Alter A SQL Server Stored Procedure ?\",\"datePublished\":\"2023-09-25T04:19:00+00:00\",\"dateModified\":\"2023-11-10T13:04:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/\"},\"wordCount\":597,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2023\/09\/create_alter_stored_procedure_laptop_1280_720.jpg\",\"keywords\":[\"Alter\"],\"articleSection\":[\"T-SQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/\",\"url\":\"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/\",\"name\":\"How To Alter A SQL Server Stored Procedure ? T-SQL\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2023\/09\/create_alter_stored_procedure_laptop_1280_720.jpg\",\"datePublished\":\"2023-09-25T04:19:00+00:00\",\"dateModified\":\"2023-11-10T13:04:12+00:00\",\"description\":\"To modify an existing SQL Server stored procedure in a database, execute a simple ALTER PROCEDURE statement to modify the code.\",\"breadcrumb\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/#primaryimage\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2023\/09\/create_alter_stored_procedure_laptop_1280_720.jpg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2023\/09\/create_alter_stored_procedure_laptop_1280_720.jpg\",\"width\":1280,\"height\":720},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"en\",\"item\":\"https:\/\/expert-only.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Alter A SQL Server Stored Procedure ?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/expert-only.com\/en\/#website\",\"url\":\"https:\/\/expert-only.com\/en\/\",\"name\":\"SQL and IT Tutorials\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/expert-only.com\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/expert-only.com\/en\/#organization\",\"name\":\"Expert-Only\",\"url\":\"https:\/\/expert-only.com\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg\",\"width\":381,\"height\":174,\"caption\":\"Expert-Only\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/ExpertOnlyCom\/\",\"https:\/\/x.com\/expert_only\",\"https:\/\/www.youtube.com\/channel\/UCMS5sR_FwAetB0FmciNvUaA\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\",\"name\":\"Expert-Only\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g\",\"caption\":\"Expert-Only\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How To Alter A SQL Server Stored Procedure ? T-SQL","description":"To modify an existing SQL Server stored procedure in a database, execute a simple ALTER PROCEDURE statement to modify the code.","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:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/","og_locale":"en_US","og_type":"article","og_title":"How To Alter A SQL Server Stored Procedure ?","og_description":"To modify an existing SQL Server stored procedure in a database, execute a simple ALTER PROCEDURE statement to modify the code.","og_url":"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/","og_site_name":"SQL and IT Tutorials","article_publisher":"https:\/\/www.facebook.com\/ExpertOnlyCom\/","article_published_time":"2023-09-25T04:19:00+00:00","article_modified_time":"2023-11-10T13:04:12+00:00","og_image":[{"width":1280,"height":720,"url":"https:\/\/expert-only.com\/wp-content\/uploads\/2023\/09\/create_alter_stored_procedure_laptop_1280_720.jpg","type":"image\/jpeg"}],"author":"Expert-Only","twitter_card":"summary_large_image","twitter_creator":"@expert_only","twitter_site":"@expert_only","twitter_misc":{"Written by":"Expert-Only","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/#article","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/"},"author":{"name":"Expert-Only","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef"},"headline":"How To Alter A SQL Server Stored Procedure ?","datePublished":"2023-09-25T04:19:00+00:00","dateModified":"2023-11-10T13:04:12+00:00","mainEntityOfPage":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/"},"wordCount":597,"commentCount":0,"publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"image":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2023\/09\/create_alter_stored_procedure_laptop_1280_720.jpg","keywords":["Alter"],"articleSection":["T-SQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/","url":"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/","name":"How To Alter A SQL Server Stored Procedure ? T-SQL","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/#primaryimage"},"image":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2023\/09\/create_alter_stored_procedure_laptop_1280_720.jpg","datePublished":"2023-09-25T04:19:00+00:00","dateModified":"2023-11-10T13:04:12+00:00","description":"To modify an existing SQL Server stored procedure in a database, execute a simple ALTER PROCEDURE statement to modify the code.","breadcrumb":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/#primaryimage","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2023\/09\/create_alter_stored_procedure_laptop_1280_720.jpg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2023\/09\/create_alter_stored_procedure_laptop_1280_720.jpg","width":1280,"height":720},{"@type":"BreadcrumbList","@id":"https:\/\/expert-only.com\/en\/t-sql\/alter-sql-server-stored-procedure\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"en","item":"https:\/\/expert-only.com\/en\/"},{"@type":"ListItem","position":2,"name":"How To Alter A SQL Server Stored Procedure ?"}]},{"@type":"WebSite","@id":"https:\/\/expert-only.com\/en\/#website","url":"https:\/\/expert-only.com\/en\/","name":"SQL and IT Tutorials","description":"","publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/expert-only.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/expert-only.com\/en\/#organization","name":"Expert-Only","url":"https:\/\/expert-only.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg","width":381,"height":174,"caption":"Expert-Only"},"image":{"@id":"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ExpertOnlyCom\/","https:\/\/x.com\/expert_only","https:\/\/www.youtube.com\/channel\/UCMS5sR_FwAetB0FmciNvUaA"]},{"@type":"Person","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef","name":"Expert-Only","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g","caption":"Expert-Only"}}]}},"_links":{"self":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/8777","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/comments?post=8777"}],"version-history":[{"count":19,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/8777\/revisions"}],"predecessor-version":[{"id":28961,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/8777\/revisions\/28961"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media\/28953"}],"wp:attachment":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media?parent=8777"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/categories?post=8777"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/tags?post=8777"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}