如何在SQL Server中重写这些TRIM Access查询

时间:2022-09-19 23:51:07

I am rewriting more code from Access to SQL Server and I have never encountered a TRIM code before, any ideas how to write it for SQL Server as far as I know there is not just plain TRIM for SQL Server

我正在从Access到SQL Server重写更多的代码,我以前从未遇到过TRIM代码,任何想法如何为SQL Server编写它据我所知,不仅仅是SQL Server的简单TRIM

Trim([FCT_TYP_CD]) & " (" & Trim([Dep_TYP_CD]) & ")" AS [Course Owner]

2 个解决方案

#1


4  

SELECT  RTRIM(LTRIM([FCT_TYP_CD])) + ' (' + 
        RTRIM(LTRIM([Dep_TYP_CD])) + ')' AS [Course Owner]

#2


1  

LTRIM(@String)
RTRIM(@string)

or

要么

LTRIM(RTRIM(@string))

#1


4  

SELECT  RTRIM(LTRIM([FCT_TYP_CD])) + ' (' + 
        RTRIM(LTRIM([Dep_TYP_CD])) + ')' AS [Course Owner]

#2


1  

LTRIM(@String)
RTRIM(@string)

or

要么

LTRIM(RTRIM(@string))