{"id":29371,"date":"2023-11-22T07:25:00","date_gmt":"2023-11-22T06:25:00","guid":{"rendered":"https:\/\/expert-only.com\/?p=29371"},"modified":"2023-11-24T13:40:59","modified_gmt":"2023-11-24T12:40:59","slug":"pass-a-list-of-values-to-a-stored-procedure-in-sql-server","status":"publish","type":"post","link":"https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/","title":{"rendered":"Pass a list of values as a parameter to a stored procedure in SQL Server"},"content":{"rendered":"\n<p>To pass a list of integer values to a stored procedure in SQL Server using a Table-Valued Parameter, also abbreviated as TVP,  is a clean and efficient approach. Here&#8217;s a step-by-step tutorial on how to use it with a simple list of integers to pass as one unique parameter to a SQL procedure.<\/p>\n\n\n\n<p><strong>The goal here is to simply pass a list of integers in one unique parameter to a SQL Server stored procedure without having to pass each one in separate hard coded input parameters.<\/strong><\/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\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/#step-1-define-a-table-type-to-store-the-list-of-values\" >Step 1: Define a table type to store the list of values<\/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\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/#step-2-create-a-stored-procedure-that-uses-the-list-of-values\" >Step 2: Create a stored procedure that uses the list of values<\/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\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/#step-3-execute-the-sql-server-procedure-with-the-list-as-a-parameter\" >Step 3: Execute the SQL Server procedure with the list as a parameter<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-step-1-define-a-table-type-to-store-the-list-of-values\"><span class=\"ez-toc-section\" id=\"step-1-define-a-table-type-to-store-the-list-of-values\"><\/span>Step 1: Define a table type to store the list of values<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Before creating the stored procedure, you need to define a custom table type that represents the structure of the data you&#8217;ll pass.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Open SQL Server Management Studio (SSMS)<\/strong> and connect to your database.<\/li>\n\n\n\n<li><strong>Execute the following SQL to create a new table type<\/strong>:<\/li>\n<\/ol>\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=\"\">-- Step 1 : CREATE A TABLE TYPE\nCREATE TYPE dbo.IntegerListType AS TABLE \n(\n   Number INT\n);\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-2-create-a-stored-procedure-that-uses-the-list-of-values\"><span class=\"ez-toc-section\" id=\"step-2-create-a-stored-procedure-that-uses-the-list-of-values\"><\/span>Step 2: Create a stored procedure that uses the list of values<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Now, create a stored procedure that accepts this table type as a parameter.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>In a new query window, write the following SQL code:<\/strong><\/li>\n<\/ul>\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=\"\">-- Step 2 : CREATE THE STORED PROCEDURE\nCREATE PROCEDURE [dbo].[SelectCustomersByIDs]\n   @CustomerIDs dbo.IntegerListType READONLY\nAS\nBEGIN\n\n   SELECT *\n   FROM   CUSTOMERS\n   WHERE  CustomerID\n      IN  (SELECT Number FROM @CustomerIDs)\n\nEND<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Replace YourDataTable and YourDataColumn with the names of your actual table and column. This procedure will select rows from YourDataTable where YourDataColumn matches any of the integers in the provided list.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"554\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2023\/11\/matrix-computer-hacker-2354492-1024x554.jpg\" alt=\"Pass a list of values as one input parameter to a SQL stored procedure help reduce the code \" class=\"wp-image-29380\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2023\/11\/matrix-computer-hacker-2354492-1024x554.jpg 1024w, https:\/\/expert-only.com\/wp-content\/uploads\/2023\/11\/matrix-computer-hacker-2354492-300x162.jpg 300w, https:\/\/expert-only.com\/wp-content\/uploads\/2023\/11\/matrix-computer-hacker-2354492-768x415.jpg 768w, https:\/\/expert-only.com\/wp-content\/uploads\/2023\/11\/matrix-computer-hacker-2354492.jpg 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><em>Pass a list of values as one input parameter to a SQL stored procedure help reduce the code <\/em><\/figcaption><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-3-execute-the-sql-server-procedure-with-the-list-as-a-parameter\"><span class=\"ez-toc-section\" id=\"step-3-execute-the-sql-server-procedure-with-the-list-as-a-parameter\"><\/span>Step 3: Execute the SQL Server procedure with the list as a parameter<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To use this stored procedure, you&#8217;ll populate a variable of the IntegerListType <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Glossary\/Parameter\" target=\"_blank\" rel=\"noreferrer noopener\">parameter<\/a> with the integers you want to pass and then execute the procedure.<\/p>\n\n\n\n<p><strong>In a new query window, execute the following SQL<\/strong>:<\/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=\"\">-- Step 3 : CALL THE PROCEDURE WITH THE TABLE VARIABLE\nDECLARE @MyCustomerIDs IntegerListType;\n\nINSERT INTO @MyCustomerIDs (Number)\nVALUES (1), (2), (3);\n\nEXEC [dbo].[SelectCustomersByID]\n   @CustomerIDs = @MyCustomerIDs; <\/pre>\n\n\n\n<p>Of course, it is a generic example,  so you need to replace (1), (2), (3) with the list of integers you want to query. One very useful piece of code in this case would be how to transform directly the list that comes in a comma separated list into a column.<\/p>\n\n\n\n<p>This script is a variant that allows you to transform a list of values separated values into a column. <\/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=\"\">DECLARE @MyCustomerIDs IntegerListType;\n\nINSERT INTO @MyCustomerIDs (Number)\nSELECT CAST(value AS INT)\nFROM   STRING_SPLIT('1;3;5', ';');\n\n-- To view the contents of the table variable\nSELECT *\nFROM   @MyCustomerIDs;\n<\/pre>\n\n\n\n<p><strong>On the same topic, this detailed tutorial allows you <a href=\"https:\/\/expert-only.com\/en\/t-sql\/split-text-into-columns-sql-server\/\">to transform any separated value list into a column<\/a>.<\/strong><\/p>\n\n\n\n<p><em>Of course, before executing the script you need to create the sample table.<\/em><\/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=\"\">DROP TABLE IF EXISTS [dbo].[CUSTOMERS];\n\nCREATE TABLE [dbo].[CUSTOMERS](\n\t[CustomerID] [int] IDENTITY(1,1) NOT NULL,\n\t[FirstName] [nvarchar](20) NULL,\n\t[LastName] [nvarchar](20) NULL,\n\t[AddressText] [nvarchar](100) NULL,\n\t[CountryCode] [nvarchar](3) NULL,\n\t[CountryName] [nvarchar](50) NULL\n);\n\nINSERT [dbo].[CUSTOMERS] ( [FirstName], [LastName], [AddressText], [CountryCode], [CountryName])\nVALUES\n  (N'Ana', N'Santos', N'123 Rua Principal, Lisbon', N'PT', N'Portugal'),\n  (N'Kenji', N'Takahashi', N'456 Nishi-Dori, Tokyo', N'JP', N'Japan'),\n  (N'Amina', N'Khan', N'789 Shahrah-e-Faisal, Karachi', N'PK', N'Pakistan'),\n  (N'Igor', N'Smirnov', N'321 Krasnaya Ulitsa, Moscow', N'RU', N'Russia'),\n  (N'Sophie', N'Dupont', N'654 Rue de Rivoli, Paris', N'FR', N'France');\n\nSELECT * FROM [dbo].[CUSTOMERS];\n<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-step-by-step-tutorial-explained-in-video\">Step by step tutorial explained in video<\/h4>\n\n\n\n<div style=\"text-align: center;\">\n<iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/mYWAsx-z_hM?si=8OKAnIoUMUDVQs-z&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<h3 class=\"wp-block-heading\" id=\"h-advantages-of-using-table-valued-parameters\">Advantages of Using Table-Valued Parameters<\/h3>\n\n\n\n<p><a href=\"https:\/\/expert-only.com\/t-sql\/table-valued-parameter-stored-procedure\/\">Table-Valued Parameters in SQL Server<\/a> are highly efficient for large datasets and provide type safety by ensuring correct data types, such as integers. This reduces error risks significantly. Additionally, they enhance security by offering protection against SQL injection, a common risk in dynamically constructed SQL queries, making them a safer and more reliable choice for database operations.<\/p>\n\n\n\n<p>And that&#8217;s it for this short tutorial on how to pass a list of integer values to a stored procedure in SQL Server using a table-valued parameter. This method is particularly useful for performing operations on a specific set of data identified by those integers.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>To pass a list of integer values to a stored procedure in SQL Server using a Table-Valued Parameter, also abbreviated as TVP, is a clean and efficient approach. Here&#8217;s a step-by-step tutorial on how to use it with a <a class=\"mh-excerpt-more\" href=\"https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/\" title=\"Pass a list of values as a parameter to a stored procedure in SQL Server\">&#8230;<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":10797,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-29371","post","type-post","status-publish","format-standard","has-post-thumbnail"],"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>Pass list of values as parameter to a stored procedure -<\/title>\n<meta name=\"description\" content=\"Step by step examples of code to easily pass a list of integer values as one parameter to a stored procedure in SQL Server.\" \/>\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\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Pass a list of values as a parameter to a stored procedure in SQL Server\" \/>\n<meta property=\"og:description\" content=\"Step by step examples of code to easily pass a list of integer values as one parameter to a stored procedure in SQL Server.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/\" \/>\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-11-22T06:25:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-24T12:40:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/one-hundred-64289A5CC0F_1920x1080.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\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\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/\"},\"author\":{\"name\":\"Expert-Only\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\"},\"headline\":\"Pass a list of values as a parameter to a stored procedure in SQL Server\",\"datePublished\":\"2023-11-22T06:25:00+00:00\",\"dateModified\":\"2023-11-24T12:40:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/\"},\"wordCount\":500,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/one-hundred-64289A5CC0F_1920x1080.jpg\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/\",\"url\":\"https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/\",\"name\":\"Pass list of values as parameter to a stored procedure -\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/one-hundred-64289A5CC0F_1920x1080.jpg\",\"datePublished\":\"2023-11-22T06:25:00+00:00\",\"dateModified\":\"2023-11-24T12:40:59+00:00\",\"description\":\"Step by step examples of code to easily pass a list of integer values as one parameter to a stored procedure in SQL Server.\",\"breadcrumb\":{\"@id\":\"https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/#primaryimage\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/one-hundred-64289A5CC0F_1920x1080.jpg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/one-hundred-64289A5CC0F_1920x1080.jpg\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"en\",\"item\":\"https:\/\/expert-only.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Pass a list of values as a parameter to a stored procedure in SQL Server\"}]},{\"@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":"Pass list of values as parameter to a stored procedure -","description":"Step by step examples of code to easily pass a list of integer values as one parameter to a stored procedure in SQL Server.","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\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/","og_locale":"en_US","og_type":"article","og_title":"Pass a list of values as a parameter to a stored procedure in SQL Server","og_description":"Step by step examples of code to easily pass a list of integer values as one parameter to a stored procedure in SQL Server.","og_url":"https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/","og_site_name":"SQL and IT Tutorials","article_publisher":"https:\/\/www.facebook.com\/ExpertOnlyCom\/","article_published_time":"2023-11-22T06:25:00+00:00","article_modified_time":"2023-11-24T12:40:59+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/one-hundred-64289A5CC0F_1920x1080.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\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/#article","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/"},"author":{"name":"Expert-Only","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef"},"headline":"Pass a list of values as a parameter to a stored procedure in SQL Server","datePublished":"2023-11-22T06:25:00+00:00","dateModified":"2023-11-24T12:40:59+00:00","mainEntityOfPage":{"@id":"https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/"},"wordCount":500,"commentCount":0,"publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"image":{"@id":"https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/one-hundred-64289A5CC0F_1920x1080.jpg","inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/","url":"https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/","name":"Pass list of values as parameter to a stored procedure -","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/#primaryimage"},"image":{"@id":"https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/one-hundred-64289A5CC0F_1920x1080.jpg","datePublished":"2023-11-22T06:25:00+00:00","dateModified":"2023-11-24T12:40:59+00:00","description":"Step by step examples of code to easily pass a list of integer values as one parameter to a stored procedure in SQL Server.","breadcrumb":{"@id":"https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/#primaryimage","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/one-hundred-64289A5CC0F_1920x1080.jpg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/one-hundred-64289A5CC0F_1920x1080.jpg","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/expert-only.com\/en\/uncategorized\/pass-a-list-of-values-to-a-stored-procedure-in-sql-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"en","item":"https:\/\/expert-only.com\/en\/"},{"@type":"ListItem","position":2,"name":"Pass a list of values as a parameter to a stored procedure in SQL Server"}]},{"@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\/29371","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=29371"}],"version-history":[{"count":18,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/29371\/revisions"}],"predecessor-version":[{"id":29464,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/29371\/revisions\/29464"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media\/10797"}],"wp:attachment":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media?parent=29371"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/categories?post=29371"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/tags?post=29371"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}