下面的T-SQL语句导致我的一个SSIS打包在执行结束时“挂起”。由于没有错误消息或反馈,因为一些看不见的问题,软件包根本无法完成运行。想到的两件事是A)我想要推送的azure数据库不想给我更新/删除权限B)我的T-SQL语法有问题。
我将假设它的B因为10次中有9次可能是我的错误,而不是系统错误。这个陈述中有什么可能导致这个循环吗?
--UPDATE
BEGIN
UPDATE
REPORTING
SET
REPORTING.Supplier = dbo.SupplierQuality_ASL_TEMP.Supplier,
REPORTING.Level = dbo.SupplierQuality_ASL_TEMP.Level,
REPORTING.Status = dbo.SupplierQuality_ASL_TEMP.Status,
REPORTING.[Core Competency Service Provided] = dbo.SupplierQuality_ASL_TEMP.[Core Competency Service Provided],
REPORTING.Location = dbo.SupplierQuality_ASL_TEMP.Location,
REPORTING.[Outsourced Process] = dbo.SupplierQuality_ASL_TEMP.[Outsourced Process],
REPORTING.Contact = dbo.SupplierQuality_ASL_TEMP.Contact,
REPORTING.Phone = dbo.SupplierQuality_ASL_TEMP.Phone,
REPORTING.Email = dbo.SupplierQuality_ASL_TEMP.Email
FROM
[AZURE_REPORTING].[Reporting_Warehouse].[dbo].[SupplierQuality_ASL] as REPORTING
INNER JOIN dbo.SupplierQuality_ASL_TEMP
ON REPORTING.SubtaskID = dbo.SupplierQuality_ASL_TEMP.SubtaskID
WHERE
REPORTING.SubtaskID = dbo.SupplierQuality_ASL_TEMP.SubtaskID
AND REPORTING.SubtaskID IS NOT NULL AND dbo.SupplierQuality_ASL_TEMP.SubtaskID IS NOT NULL
END
--DELETE
BEGIN
DELETE REPORTING
FROM [AZURE_REPORTING].[Reporting_Warehouse].[dbo].[SupplierQuality_ASL] as REPORTING
WHERE
NOT EXISTS
(
SELECT *
FROM dbo.SupplierQuality_ASL_TEMP
WHERE REPORTING.SubtaskID = dbo.SupplierQuality_ASL_TEMP.SubtaskID
)
END
答案 0 :(得分:1)
不是最终答案,但会显示锁定。尝试:
BEGIN
DELETE top(10) REPORTING
FROM [AZURE_REPORTING].[Reporting_Warehouse].[dbo].[SupplierQuality_ASL] as REPORTING
WHERE NOT EXISTS ( SELECT 1
FROM dbo.SupplierQuality_ASL_TEMP as TEMP
WHERE REPORTING.SubtaskID = TEMP.SubtaskID
)
END