{"id":26449,"date":"2023-06-02T06:52:00","date_gmt":"2023-06-02T04:52:00","guid":{"rendered":"https:\/\/expert-only.com\/?p=26449"},"modified":"2023-08-07T17:01:21","modified_gmt":"2023-08-07T15:01:21","slug":"sql-server-concat-function","status":"publish","type":"post","link":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/","title":{"rendered":"How to use the SQL Server CONCAT function to concatenate text?"},"content":{"rendered":"\n<h4 class=\"wp-block-heading has-text-align-left\" id=\"h-use-the-concat-function-in-sql-server-to-join-two-or-more-strings-into-one-unique-string\"><em>Use the CONCAT function in SQL Server to join two or more strings into one unique string.<\/em><\/h4>\n\n\n\n<p>The SQL Server CONCAT function takes up to 255 input arguments, which can be any valid expression as long as they are not of the text data type. If any argument is NULL, CONCAT will treat it as an empty string. For instance, let&#8217;s insert some data into the <code>Products<\/code> table, and then use CONCAT to join <code>Name<\/code> and <code>Description<\/code>.<\/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\/sql-server-concat-function\/#1-introduction-to-the-t-sql-concat-function\" >1. Introduction to the T-SQL CONCAT function<\/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\/sql-server-concat-function\/#2-simple-sql-server-concat-example\" >2. Simple SQL Server CONCAT example<\/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\/sql-server-concat-function\/#3-concatenate-multiple-strings-in-sql-server\" >3. Concatenate Multiple Strings in SQL Server<\/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\/sql-server-concat-function\/#4-using-null-values-in-sql-server-concatenation\" >4. Using Null Values in SQL Server concatenation<\/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\/sql-server-concat-function\/#5concatenate-text-and-non-string-values\" >5.Concatenate text and Non-String Values<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/#6-using-the-concat-ws-text-function\" >6. Using the CONCAT_WS text function<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/#7-using-concat-with-conditional-statements-in-sql-server\" >7. Using CONCAT with Conditional Statements in SQL Server<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/#8-using-concat-and-join-operations\" >8. Using CONCAT and JOIN Operations<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/#9-concat-and-aggregate-functions-in-sql-server\" >9. CONCAT and Aggregate Functions in SQL Server<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/#10-using-the-concat-function-in-stored-procedures\" >10. Using the CONCAT function in Stored Procedures<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-1-introduction-to-the-t-sql-concat-function\"><span class=\"ez-toc-section\" id=\"1-introduction-to-the-t-sql-concat-function\"><\/span>1. Introduction to the T-SQL CONCAT function<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The CONCAT function in SQL Server allows developers to concatenate strings. It takes as arguments the strings to concatenated. Here is the basic syntax: <code>CONCAT(string1, string2, ..., stringN)<\/code>. It&#8217;s important to mention that if any of these strings is null, CONCAT will treat it as an empty string. First, let&#8217;s start with an example using the following table structure and data:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">CREATE TABLE Products(\n    ProductID int PRIMARY KEY,\n    Name varchar(100),\n    Description varchar(500),\n    Price decimal(10,2),\n    Category varchar(100)\n);\n\nINSERT INTO Products(ProductID, Name, Description, Price, Category) \nVALUES (1, 'Refrigerator', 'Large with double doors', 1500.00, 'Electronics'),\n       (2, 'Microwave', 'Compact with quick heating feature', 200.00, 'Electronics'),\n       (3, 'Television', '55 inches with 4K resolution', 1200.00, 'Electronics');\n\n<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2-simple-sql-server-concat-example\"><\/span>2. Simple SQL Server CONCAT example <span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Let&#8217;s start with a simple example. If you want to combine the Name and Description of products into a single string, you can use the CONCAT function like this:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SELECT CONCAT(Name, ' - ', Description) AS ProductDetails \nFROM Products;\n<\/pre>\n\n\n\n<p>The above query will result in a new column, ProductDetails, containing the Name and Description of each product separated by a hyphen.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3-concatenate-multiple-strings-in-sql-server\"><\/span>3. Concatenate Multiple Strings in SQL Server<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>With this third SQL code example, you can pass more than two strings to the CONCAT function. Let&#8217;s add the price to the product details:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SELECT CONCAT(Name, ' - ', Description, ' - ', Price) AS ProductDetails \nFROM Products;\n<\/pre>\n\n\n\n<p>Now, the ProductDetails column will also contain the Price of each product.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4-using-null-values-in-sql-server-concatenation\"><\/span>4. Using Null Values in SQL Server concatenation<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>As mentioned earlier in this tutorial, if one of the strings passed to CONCAT is null, <strong>it will be treated as an empty string<\/strong>. Here is an example to illustrate this particular case:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">UPDATE Products \nSET Description = NULL \nWHERE ProductID = 3;\n\nSELECT CONCAT(Name, ' - ', Description, ' - ', Price) AS ProductDetails \nFROM Products;\n<\/pre>\n\n\n\n<p>Even though the description for the third product is null, the CONCAT function will not result in a null value. It will treat the null description as an empty string.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"5concatenate-text-and-non-string-values\"><\/span>5.Concatenate text and Non-String Values<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Moreover, the CONCAT text function can accept non-string arguments. If a non-string value is passed, <strong><em>it will be implicitly converted to a string<\/em><\/strong>. Here is an example of how the ProductID is transformed to text:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SELECT CONCAT('Product ID: ', ProductID, ', Name: ', Name) AS ProductDetails \nFROM Products;\n<\/pre>\n\n\n\n<p>In this query, the ProductID, which is an integer, is concatenated with some strings to create the ProductDetails column.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"6-using-the-concat-ws-text-function\"><\/span>6. Using the CONCAT_WS text function<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In SQL Server, you can use the CONCAT_WS (Concatenate With Separator) function to concatenate strings with an explicitly specified separator. This can be very useful when dealing with multiple strings, like different columns.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SELECT CONCAT_WS(' - ', Name, Description, Price) AS ProductDetails \nFROM Products;\n<\/pre>\n\n\n\n<p>In this example, CONCAT_WS adds a hyphen between each of the concatenated strings. If any of the strings is null, it will be ignored, and the hyphen will not be added. In this other T-SQL tutorial, here&#8217;s <a href=\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-dates-in-t-sql\/\"><strong>how to manage SQL Server dates using built-in functions<\/strong><\/a>.<\/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=\"gcvzDODbe8\"><a href=\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-dates-in-t-sql\/\">How to manage dates in T-SQL ?<\/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 manage dates in T-SQL ?&#8221; &#8212; SQL and IT Tutorials\" src=\"https:\/\/expert-only.com\/en\/t-sql\/how-to-manage-dates-in-t-sql\/embed\/#?secret=VMJl4wJ8It#?secret=gcvzDODbe8\" data-secret=\"gcvzDODbe8\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p><strong><em>Now let&#8217;s dive into some more advance concatenation techniques used in real life databases projects.<\/em><\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"7-using-concat-with-conditional-statements-in-sql-server\"><\/span>7. Using CONCAT with Conditional Statements in SQL Server<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this section, let&#8217;s see how to use the CONCAT function along with CASE WHEN statement to conditionally concatenate values. Let&#8217;s consider an example where we only want to include the price in the ProductDetails if it is above 1000.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SELECT CONCAT(Name, ' - ', Description, \n              CASE \n                WHEN Price > 1000 THEN CONCAT(' - ', Price) \n                ELSE '' \n              END) AS ProductDetails \nFROM Products;\n<\/pre>\n\n\n\n<p>In the above example, the price will only be concatenated to the ProductDetails if it is above 1000. If not, an empty string is concatenated. The overall behaviour is similar in SQL Server <a href=\"https:\/\/www.w3schools.in\/python\/examples\/concatenate-strings-in-python\" target=\"_blank\" rel=\"noreferrer noopener\">and Python<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"8-using-concat-and-join-operations\"><\/span>8. Using CONCAT and JOIN Operations<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The CONCAT function can also be used with JOIN operations to merge data from different tables. Assume we have another table, <code>Categories<\/code>, containing CategoryID and CategoryName. Let&#8217;s add some category data and demonstrate this:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">CREATE TABLE Categories(\n    CategoryID int PRIMARY KEY,\n    CategoryName varchar(100)\n);\n\nINSERT INTO Categories(CategoryID, CategoryName) \nVALUES (1, 'Electronics'),\n       (2, 'Appliances'),\n       (3, 'Furniture');\n\nUPDATE Products \nSET Category = 1 \nWHERE ProductID IN (1, 2, 3);\n\nSELECT CONCAT(P.Name, ' - ', P.Description, ' - ', C.CategoryName) AS ProductDetails \nFROM Products AS P\nINNER JOIN Categories AS C\nON P.Category = C.CategoryID;\n<\/pre>\n\n\n\n<p>In this query, we concatenate product details with the category name, pulled from the <code>Categories<\/code> table.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"9-concat-and-aggregate-functions-in-sql-server\"><\/span>9. CONCAT and Aggregate Functions in SQL Server<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In other usage, CONCAT can be used along with aggregate functions to provide more meaningful outputs. Suppose you want to get the total price of all products and output a statement, you could easily use some code like this one below. As a result, this will simply output a single row with a message stating the total price of all products.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SELECT CONCAT('The total price of all products is: ', SUM(Price)) AS TotalPrice \nFROM Products;\n<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"10-using-the-concat-function-in-stored-procedures\"><\/span>10. Using the CONCAT function in Stored Procedures<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Last but not least, the CONCAT function is not limited to SELECT queries and can be used inside stored procedures to build dynamic SQL or return information. Let&#8217;s create a stored procedure that receives a ProductID and returns a string with the product details:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">CREATE PROCEDURE GetProductDetails @ProductID int AS\nBEGIN\n    DECLARE @Result varchar(1000);\n    SELECT @Result = CONCAT(Name, ' - ', Description, ' - ', Price) \n    FROM Products\n    WHERE ProductID = @ProductID;\n\n    SELECT @Result AS ProductDetails;\nEND\n<\/pre>\n\n\n\n<p>To call this stored procedure, you can use:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">EXEC GetProductDetails @ProductID = 1;\n<\/pre>\n\n\n\n<p>The stored procedure will return a single string with the product details.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Conclusion on SQL CONCAT Function<\/h3>\n\n\n\n<p>SQL Server&#8217;s CONCAT function offers a robust method to fuse string values together. You can apply it in multiple situations, ranging from straightforward concatenation tasks to intricate database operations. Grasping its fundamental usage and the ways to integrate it with other SQL functionalities will enhance your data management and manipulation abilities.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>Use the CONCAT function in SQL Server to join two or more strings into one unique string. The SQL Server CONCAT function takes up to 255 input arguments, which can be any valid expression as long as they are <a class=\"mh-excerpt-more\" href=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/\" title=\"How to use the SQL Server CONCAT function to concatenate text?\">&#8230;<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":10532,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[454],"tags":[],"class_list":{"0":"post-26449","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-t-sql"},"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 use the SQL Server CONCAT function ? T-SQL<\/title>\n<meta name=\"description\" content=\"Tutorial on how to use the CONCAT function in SQL Server to join two or more strings into one string with multiples T-SQL code examples.\" \/>\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\/sql-server-concat-function\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to use the SQL Server CONCAT function to concatenate text?\" \/>\n<meta property=\"og:description\" content=\"Tutorial on how to use the CONCAT function in SQL Server to join two or more strings into one string with multiples T-SQL code examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/\" \/>\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-06-02T04:52:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-08-07T15:01:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/coffee-BB67D4004E4_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=\"4 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\/sql-server-concat-function\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/\"},\"author\":{\"name\":\"Expert-Only\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\"},\"headline\":\"How to use the SQL Server CONCAT function to concatenate text?\",\"datePublished\":\"2023-06-02T04:52:00+00:00\",\"dateModified\":\"2023-08-07T15:01:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/\"},\"wordCount\":824,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/coffee-BB67D4004E4_1920x1080.jpg\",\"articleSection\":[\"T-SQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/\",\"url\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/\",\"name\":\"How to use the SQL Server CONCAT function ? T-SQL\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/coffee-BB67D4004E4_1920x1080.jpg\",\"datePublished\":\"2023-06-02T04:52:00+00:00\",\"dateModified\":\"2023-08-07T15:01:21+00:00\",\"description\":\"Tutorial on how to use the CONCAT function in SQL Server to join two or more strings into one string with multiples T-SQL code examples.\",\"breadcrumb\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/#primaryimage\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/coffee-BB67D4004E4_1920x1080.jpg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/coffee-BB67D4004E4_1920x1080.jpg\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"en\",\"item\":\"https:\/\/expert-only.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to use the SQL Server CONCAT function to concatenate text?\"}]},{\"@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 use the SQL Server CONCAT function ? T-SQL","description":"Tutorial on how to use the CONCAT function in SQL Server to join two or more strings into one string with multiples T-SQL code examples.","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\/sql-server-concat-function\/","og_locale":"en_US","og_type":"article","og_title":"How to use the SQL Server CONCAT function to concatenate text?","og_description":"Tutorial on how to use the CONCAT function in SQL Server to join two or more strings into one string with multiples T-SQL code examples.","og_url":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/","og_site_name":"SQL and IT Tutorials","article_publisher":"https:\/\/www.facebook.com\/ExpertOnlyCom\/","article_published_time":"2023-06-02T04:52:00+00:00","article_modified_time":"2023-08-07T15:01:21+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/coffee-BB67D4004E4_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":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/#article","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/"},"author":{"name":"Expert-Only","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef"},"headline":"How to use the SQL Server CONCAT function to concatenate text?","datePublished":"2023-06-02T04:52:00+00:00","dateModified":"2023-08-07T15:01:21+00:00","mainEntityOfPage":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/"},"wordCount":824,"commentCount":0,"publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"image":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/coffee-BB67D4004E4_1920x1080.jpg","articleSection":["T-SQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/","url":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/","name":"How to use the SQL Server CONCAT function ? T-SQL","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/#primaryimage"},"image":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/coffee-BB67D4004E4_1920x1080.jpg","datePublished":"2023-06-02T04:52:00+00:00","dateModified":"2023-08-07T15:01:21+00:00","description":"Tutorial on how to use the CONCAT function in SQL Server to join two or more strings into one string with multiples T-SQL code examples.","breadcrumb":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/#primaryimage","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/coffee-BB67D4004E4_1920x1080.jpg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/coffee-BB67D4004E4_1920x1080.jpg","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/expert-only.com\/en\/t-sql\/sql-server-concat-function\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"en","item":"https:\/\/expert-only.com\/en\/"},{"@type":"ListItem","position":2,"name":"How to use the SQL Server CONCAT function to concatenate text?"}]},{"@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\/26449","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=26449"}],"version-history":[{"count":0,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/26449\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media\/10532"}],"wp:attachment":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media?parent=26449"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/categories?post=26449"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/tags?post=26449"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}