SQL Server String Functions-2

A string function accepts a string value as an input and returns a string value regardless of the data type. They’re used to convert an existing string value to a different format, change the letter cases, retrieve a portion of it, or determine the length of it. They are utilized in reports, logic implementation, and data analysis on a daily basis.

This will be a series of postings since we will go over each one in detail with one or more examples for simple comprehension. So continue reading.

For previous article, click here.

CONCAT:
This function returns a string resulting from the concatenation, or joining, of two or more string values in an end-to-end manner.

  Syntax:
CONCAT ( string_value1, string_value2 [, string_valueN ] )


Example:

SELECT CONCAT(e.Ename, ‘ ‘, d.Dname)
FROM Emp e
INNER JOIN Dept d ON e.deptNo = d.DeptNo
WHERE e.DeptNo = 10
GO

SELECT CONCAT(‘Name: ‘,e.Ename, ‘ ‘, ‘Department: ‘, d.Dname)
FROM Emp e
INNER JOIN Dept d ON e.deptNo = d.DeptNo
WHERE e.DeptNo = 10
GO

Concat_SQLServer

Please continue to read the articles on String functions that will be published in the near future.

4 comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s