How to resolve TRIM is not a recognized built-in function name
TRIM
is launched in SQL Server (beginning with 2017).
In older model of SQL Server to carry out trim it’s a must to use LTRIM
and RTRIM
like following.
DECLARE @ss varchar(60) SET @ss=" admin " choose RTRIM(LTRIM(@ss))
If you don’t like utilizing LTRIM
, RTRIM
in every single place, you may create your individual customized function like following.
CREATE FUNCTION dbo.TRIM(@string NVARCHAR(max)) RETURNS NVARCHAR(max) BEGIN RETURN LTRIM(RTRIM(@string)) END GO
TRIM is not a recognized built-in function name
TRIM
is launched in SQL Server (beginning with 2017).
In older model of SQL Server to carry out trim it’s a must to use LTRIM
and RTRIM
like following.
DECLARE @ss varchar(60) SET @ss=" admin " choose RTRIM(LTRIM(@ss))
If you don’t like utilizing LTRIM
, RTRIM
in every single place, you may create your individual customized function like following.
CREATE FUNCTION dbo.TRIM(@string NVARCHAR(max)) RETURNS NVARCHAR(max) BEGIN RETURN LTRIM(RTRIM(@string)) END GO
TRIM
is launched in SQL Server (beginning with 2017).
In older model of SQL Server to carry out trim it’s a must to use LTRIM
and RTRIM
like following.
DECLARE @ss varchar(60)
SET @ss=" admin "
choose RTRIM(LTRIM(@ss))
If you don’t like utilizing LTRIM
, RTRIM
in every single place, you may create your individual customized function like following.
CREATE FUNCTION dbo.TRIM(@string NVARCHAR(max))
RETURNS NVARCHAR(max)
BEGIN
RETURN LTRIM(RTRIM(@string))
END
GO
Perhaps it’s set to an earlier compatibility degree.
Use this to seek out out:
SELECT compatibility_level FROM sys.databases
SQL Server 2017 is 140
If it’s any decrease then it received’t acknowledge TRIM
To change the compatibility to SQL Server 2017
ALTER DATABASE database_name
SET COMPATIBILITY_LEVEL = 140
For a listing of supported compatibility ranges for every SQL Server model take a look at ALTER DATABASE (Transact-SQL) Compatibility Level.
Based on feedback beneath, your put in model of SQL Server is SQL 2016. You want to put in SQL Sever 2017 to get TRIM
You can use this code for older variations:
SELECT RTRIM (LTRIM (' JKL ')) AS Trimmed
Which leads to 'JKL'