Use of CONCAT Function in SQL

Use of CONCAT Function in SQL:

(1) “CONCAT” function is used to add two or more strings together.

(2) Let’s take an example to Add Vendor No. and Vendor Name field in one string in Vendor table as shown.

(3) Select the database in the SQL server and click on the “New Query” button as shown.

Select the database in the SQL server and click on the new query button

(4) After that new query editor opens as shown.

new query editor open in sql

(5) After doing the above steps, write a query in the editor, as shown.

CONCAT Function query in SQL editor

Source Code:

–//CONCAT add two fields value in one
Select [No_] as [Vendor No.],[Name] as [Vendor Name],
CONCAT([No_],’ – ‘,[Name])AS [Concatenate two fields]
fromdbo.[CRONUS India Ltd_$Vendor$437dbf0e-84ff-417a-965d-ed2bb9650972] TB1
–//CONCAT add two fields value in one

(6) Then Execute or Press F5 to run the query and see the result as shown.

execute concat query in sql by f5

Use of CHARINDEX Function in SQL
Use of INNER JOIN in SQL Server
Use of UPDATE Statement in SQL
Sales Order Short Closed Feature in BC D365
Record.TransferFields(var Record [, Boolean]) Method– Microsoft Docs

Leave a Reply