一尘不染

如何在SQL Server中使用TRIM函数

sql

我无法使此TRIM代码正常工作

SELECT 
   dbo.COL_V_Cost_GEMS_Detail.TNG_SYS_NR AS [EHP Code], 
   dbo.COL_TBL_VCOURSE.TNG_NA AS [Course Title], 
   LTRIM(RTRIM(FCT_TYP_CD)& ') AND (' & LTRIM(RTRIM(DEP_TYP_ID) & ')' AS [Course Owner]

阅读 101

收藏
2021-03-17

共1个答案

一尘不染

您缺少两个右括号…并且我不确定&符是否可以用作字符串连接运算符。尝试“ +”

SELECT dbo.COL_V_Cost_GEMS_Detail.TNG_SYS_NR AS [EHP Code], 
dbo.COL_TBL_VCOURSE.TNG_NA AS [Course Title], 
LTRIM(RTRIM(FCT_TYP_CD)) + ') AND (' + LTRIM(RTRIM(DEP_TYP_ID)) + ')' AS [Course Owner]
2021-03-17