我正在创建如下程序,当我运行它时,出现以下错误
客户端渲染期间发生错误。
报告处理过程中发生错误。
无法读取数据集 dsCitiDriverStats 的下一个数据行。将 nvarchar 值“瑞典语”转换为数据类型 int 时转换失败。
存储过程的源代码如下:
Create PROCEDURE [dbo].[usp_DWReport_CITICallDrivers_Test1]
@pTransactionsCreatedFrom DATETIME,
@pTransactionsCreatedTo DATETIME,
@pCallerType NVARCHAR(4000),
@pCompany NVARCHAR(4000)
AS
BEGIN
SET NOCOUNT ON;
SET DATEFIRST 1;
DECLARE @ComCount int
SET @ComCount = ( SELECT CAST(LEN(@pCompany) AS int) )
print @ComCount
IF @ComCount < 4000
BEGIN
SELECT en.ENQ_CREATION_DT AS [Date] ,
DATEPART(dw, en.ENQ_CREATION_DT) AS WeekDayNo,
en.ENQ_SOURCE AS CallType,
CASE enq_caller_type
WHEN '1389' THEN '3rd'
WHEN '1390' THEN 'CAS'
WHEN '1391' THEN 'CH'
WHEN '1392' THEN 'PA'
ELSE NULL
END AS CallerType,
RIGHT(en.ENQ_CC_NUMBER, 6) AS Last6DigitsOfCardNo,
en.ENQ_CUSTOMER_NAME AS CustomerName,
en.ENQ_COMPANY_NAME AS CustomerCompany,
a.ACCNT_CON_FST_NAME AS LineOfBusiness,
en.ENQ_ECOUNT_ID AS EcountID,
lov.Value1 AS [Language],
en.ENQ_OUTCOME AS ClassificationOfTheCall,
en.ENQ_COMMENTS_LONG AS Comments,
en.ENQ_CREATOR_LOGIN AS AgentInitials,
CASE en.ENQ_CUSTOM_CHK1
WHEN 1 THEN 'Yes'
WHEN 0 THEN 'No'
ELSE NULL
END AS VIP
FROM ENQUIRY en
JOIN ACCOUNTS a ON a.ACCNT_ID = en.ENQ_ACCNT_CSN
JOIN DW_Admin.dw_hold_listofvalue lov ON en.ENQ_LANGUAGE = lov.ID
WHERE en.ENQ_CREATION_DT >= @pTransactionsCreatedFrom
AND en.ENQ_CREATION_DT < DATEADD(dd, DATEDIFF(dd, 0, @pTransactionsCreatedTo) + 1, 0)
AND a.ACCNT_CON_FST_NAME IN ( SELECT s.Item FROM dbo.Split( @pCallerType , ',' ) s )
AND en.ENQ_COMPANY_NAME IN ( SELECT s.Item FROM dbo.Split( @pCompany , ',' ) s )
END
ELSE
BEGIN
print 'more than 4K'
SELECT en.ENQ_CREATION_DT AS [Date],
DATEPART(dw, en.ENQ_CREATION_DT) AS WeekDayNo,
en.ENQ_SOURCE AS CallType,
CASE enq_caller_type
WHEN '1389' THEN '3rd'
WHEN '1390' THEN 'CAS'
WHEN '1391' THEN 'CH'
WHEN '1392' THEN 'PA'
ELSE NULL
END AS CallerType,
RIGHT(en.ENQ_CC_NUMBER, 6) AS Last6DigitsOfCardNo,
en.ENQ_CUSTOMER_NAME AS CustomerName,
en.ENQ_COMPANY_NAME AS CustomerCompany,
a.ACCNT_CON_FST_NAME AS LineOfBusiness,
en.ENQ_ECOUNT_ID AS EcountID,
lov.Value1 AS [Language],
en.ENQ_OUTCOME AS ClassificationOfTheCall,
en.ENQ_COMMENTS_LONG AS Comments,
en.ENQ_CREATOR_LOGIN AS AgentInitials,
CASE en.ENQ_CUSTOM_CHK1
WHEN 1 THEN 'Yes'
WHEN 0 THEN 'No'
ELSE NULL
END AS VIP
FROM ENQUIRY en
JOIN ACCOUNTS a ON a.ACCNT_ID = en.ENQ_ACCNT_CSN
JOIN DW_Admin.dw_hold_listofvalue lov ON en.ENQ_LANGUAGE = lov.ID
WHERE en.ENQ_CREATION_DT >= @pTransactionsCreatedFrom
AND en.ENQ_CREATION_DT < DATEADD(dd, DATEDIFF(dd, 0, @pTransactionsCreatedTo) + 1, 0)
AND a.ACCNT_CON_FST_NAME IN ( SELECT s.Item FROM dbo.Split( @pCallerType , ',' ) s)
AND en.ENQ_COMPANY_NAME IN ( SELECT DISTINCT
COMP_NAME
FROM COMPANIES
WHERE COMP_STATUS = 'Active'
)
END
RETURN 0
END
请指教