我的程序在复杂查询中间歇性失败。
错误如下:
System.Data.SqlClient.SqlException:无法从链接服务器“LinkedServer”的OLE DB提供程序“MSDASQL”中获取行。
查询如下所示:
SELECT Replace([JOB-NO],'M0','') as KeyTaskID,
dbo.SFGET_UniqueTaskID([CLIENT-CODE],Replace([JOB-NO], 'M0', ''), 0, [TRADE-CODE]) AS HMSUniqueTaskID,
[LATEST-PRIORITY] AS PriorityCode,
[KeyProperty] AS KeyProperty,
Replace([JOB-NO],'M0','') AS KeyJob,
[JOB-TYPE] as TaskSubType,
CONVERT(varchar(6),[MAINT-OFFICER]) AS Officer,
LEFT(FORENAME + ' ' + SURNAME, 50) AS OfficerName,
[JOB-NO] + ' ' + LEFT(RTRIM(REPLACE([TEXT-LINE], ';', CHAR(13))), 480) AS Description,
dbo.SFGET_FormattedDate([TARGET-DATE],0) AS DueDateTime,
[CURRENT-STAGE-CODE] AS CurrentStageCode
FROM openquery(LinkedServer, '
SELECT DISTINCT
"RM-JOB"."JOB-NO",
"RM-JOB"."CLIENT-CODE",
"RM-JOB"."LATEST-PRIORITY",
"RM-JOB"."TRADE-CODE",
"RM-JOB"."JOB-TYPE",
"RM-JOB"."TARGET-DATE",
"RM-JOB"."MAINT-OFFICER",
"RM-JOB"."TEXT-LINE",
"RM-JOB"."CURRENT-STAGE-CODE",
"RM-JOB"."PLACE-REF",
"IH_OFFICER".FORENAME,
"IH_OFFICER".SURNAME
FROM "PUB"."RM-JOB"
LEFT OUTER JOIN "PUB"."IH_OFFICER"
ON ("IH_OFFICER"."OFFICER-CODE" = "RM-JOB"."MAINT-OFFICER")
WHERE "RM-JOB"."JOB-TYPE" = ''GASS''
AND "RM-JOB"."JOB-STATUS" = 06
AND "RM-JOB"."CONTRACTOR" = ''NWH001'' ') as ibsTasks
INNER JOIN [SVSExtract].[dbo].Property prop
ON ibsTasks.[PLACE-REF] = prop.UserCode
我一直在使用SQL Server Management Studio手动测试它。它偶尔会失败但主要工作正常。
我不知道如何调试我无法随意重现的错误。
有什么建议吗?
答案 0 :(得分:0)
我自己并不精通SqlClients和Progress,但是:Progress Knowledgebase可能会给你一个解决方案!
例如,This entry描述了一个类似的错误,即使提到的版本可能比您使用的版本旧? (在询问OpenEdge时总是发布版本 - 那里有很多旧的安装,而且Progress在过去几年中发展了很多)。
诚然,最好使用Google搜索知识库:
搜索实例:site:knowledgebase.progress.com MSDASQL
,您将获得48 results。