Skip to content

ErcanOPAK.com

  • ASP.Net WebForms
  • ASP.Net MVC
  • C#
  • SQL
  • MySQL
  • PHP
  • Devexpress
  • Reportviewer
  • About
SQL

SQL Server CONCAT_WS Function (Concat with Separator)

- 13.08.20 - ErcanOPAK

The SQL Server CONCAT_WS() function concatenates two or more strings into one string with a separator. CONCAT_WS() means concatenate with separator.

The following shows the syntax of the CONCAT_WS() function:

CONCAT_WS(separator,input_string1,input_string2,[...input_stringN]);
SELECT 
    first_name, 
    last_name, 
    CONCAT_WS(', ', last_name, first_name) full_name
FROM 
    sales.customers
ORDER BY 
    first_name, 
    last_name;

The following picture shows the partial output:

SQL Server CONCAT_WS by example

Related posts:

How to solve 'incorrect syntax near the keyword WITH' problem?
Rename column SQL Server
SQL Query to Find and Replace text in a stored procedures
Capitalize words in SQL (Display data first letter uppercase rest lowercase)
Get the User Name and Domain Name from an Email Address in SQL
Post Views: 0

Post navigation

How to refresh a DIV content with Javascript
Default Values for Data Types in C#

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

January 2021
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031
« Nov    

Most Viewed Posts

  • Get the First and Last Word from a String or Sentence in SQL (243)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (194)
  • How to make some specific word(s) Bold or Underline in ReportViewer (187)
  • How to solve “Response.Redirect cannot be called in a Page callback” for DevExpress Components (182)
  • Confirm before process with ASPxButton in Devexpress (170)
  • ASPxGridView – Disable CheckBox based on condition in GridViewCommandColumn (170)
  • Find numbers with more than two decimal places in SQL (168)
  • Devexpress ASPxGridview Column Grouping in Code (164)
  • DATEADD Function in SQL (163)
  • Tense Changes When Using Reported Speech (160)

Recent Posts

  • How to auto-scroll or manually to end of div when data is added
  • Filter Rows By Max Date in SQL
  • How to Validate a DateTime in C#?
  • Convert comma separated string into a List in C#
  • Converting a List to a comma separated string in C#
  • How to add placeholder to Multiple Selection DropDownList in Asp.Net MVC
  • How to use toFixed() for Float numbers in Javascript
  • Convert List to List in one line in C#
  • How to use column search in datatable when responsive is false
  • Checking multiple contains on one string

Recent Posts

  • How to auto-scroll or manually to end of div when data is added
  • Filter Rows By Max Date in SQL
  • How to Validate a DateTime in C#?
  • Convert comma separated string into a List in C#
  • Converting a List to a comma separated string in C#

Most Viewed Posts

  • Get the First and Last Word from a String or Sentence in SQL (243)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (194)
  • How to make some specific word(s) Bold or Underline in ReportViewer (187)
  • How to solve “Response.Redirect cannot be called in a Page callback” for DevExpress Components (182)
  • Confirm before process with ASPxButton in Devexpress (170)

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter

Copyright © 2021 ErcanOPAK.com | powered by XBlog Plus WordPress Theme