我正在尝试将SQL语句转换为SQL Server 2008.那么我该怎么做呢?下面是我要转换的sql语句。我也尝试从Stackoverflow问题解决,但我没有成功How to use TO_CHAR function functionality
SELECT
C_Debt_Payment.AD_Client_ID,
(CASE WHEN C_Debt_Payment.AD_Client_ID IS NULL THEN ''
ELSE (COALESCE(TO_CHAR(TO_CHAR(COALESCE(TO_CHAR(table1.Name), ''))),'') ) END) AS AD_Client_IDR
感谢您的回复和评论
答案 0 :(得分:1)
TO_CHAR
是Oracle。在SQL Server中,使用CONVERT
:
SELECT C_Debt_Payment.AD_Client_ID,
(CASE WHEN C_Debt_Payment.AD_Client_ID IS NULL THEN '' ELSE COALESCE(CONVERT(varchar(20),table1.name),'') END) AS AD_Client_IDR