Which function in SQL is used to omit characters from a string?

TRIM() function :

This function in SQL Server is used to omit the space character or additional stated characters from the beginning or the ending of a specified string.

Features:

  • This function is used to omit the space character or some additional given characters from the beginning or the ending of a string stated.
  • This function accepts specific characters and strings.
  • This function can by default omit the front and endmost spaces from a string given.

Syntax:

TRIM([characters FROM ]string)

Parameter :

This method accepts two parameters

  • characters FROM – Specific characters which are to be omitted.
  • string – Specified string from which the stated characters or spaces are omitted.

Returns :

It returns the specified string after omitting the space character or some additional stated characters from the front or the endmost part of it.

Example:

Getting the specified string after omitting the beginning and ending space of it.

SELECT TRIM(' HLL ');

Output :

HLL