问题,传递给RIGHT函数的长度参数无效



运行脚本时收到此错误

IF OBJECT_ID('tempdb..#Interaction') IS NOT NULL BEGIN DROP TABLE #Interaction END;
SELECT   dwf.WavFileKey
,di.InteractionKey
,dpo.OwnerKey
,dwf.ShortInteractionId
,fi.InitiatedDateCode
,fi.LastLocalUserNameKey
,fi.CallDirectionKey
,fi.MediaTypeKey
,fi.TollFreeKey
,fi.WorkGroupKey
,fi.IsAnswered
,fi.ConnectedDuration
,fi.LineDuration
,fi.HoldDuration
,fi.CallDuration
,initated.[Date] AS InitiatedDate
,dun.UserName AS LastLocalUserName
INTO #Interaction
FROM Dim.WavFile dwf
INNER JOIN Dim.Interaction di ON di.InteractionId = dwf.InteractionId
LEFT JOIN Fact.Interaction fi ON fi.InteractionKey = di.InteractionKey
LEFT JOIN Dim.[Date] initated ON initated.DateCode = fi.InitiatedDateCode
LEFT JOIN Dim.UserName dun ON dun.UserNameKey = fi.LastLocalUserNameKey
LEFT JOIN Dim.CustomerPrimaryPhone dcp ON dcp.Phone = RIGHT(di.RemoteId,LEN(di.RemoteId)-2)
LEFT JOIN Dim.Owner dpo ON Dpo.OwnerId = dcp.OwnerId

消息536,级别16,状态4,第17行传递给RIGHT函数的长度参数无效。语句已终止。

我试图将-2更改为-100,但更改LEN无效。如何解决此问题或修复错误?

di.RemoteId的数据不超过1个字符。

你可以通过运行找到它们

SELECT 
*
FROM Dim.Interaction
WHERE LEN(RemoteId) <= 1

相关内容

最新更新