执行以下语句时执行procedure
之一失败。请。让我知道如何解决以下错误。
错误:
消息11719,级别15,状态1,程序SeedDimProduct,第69行[批处理开始第2行] 检查约束,默认对象,计算列,视图,用户定义函数,用户定义聚合,用户定义表类型,子查询,公用表表达式,派生表或返回语句中不允许使用NEXT VALUE FOR函数。 / p>
INSERT INTO dbo.DimProduct
(
[ProductKey]
,[ProductCode]
,[ProductCode]
,[ProductName]
,[ProductWaterfallGroupKey]
,[InsertExecutionID]
,[UpdateExecutionID]
,[DisplayOrder]
)
select distinct *
from (SELECT
NEXT VALUE FOR DBO.SQ_WATERFALL_PROD,
ProductCode = c.ResourceNo
,ProductCode = c.ProductID
,ProductName = p.[Product_NM]
,w.ProductWaterfallgroupkey
,InsertExecutionID = 0
,UpdateExecutionID = 0
,DisplayOrder = 0
FROM targit_Updated.[dbo].[FS_ContractTypeProduct_D] c
LEFT JOIN [DWSF].[dbo].[SF_Product_D] p ON c.ProductID = p.[Product_ID] COLLATE Latin1_General_CS_AS
JOIN #ProdWaterfallGrouping w on w.ReportingGroup= p.Reporting_Group_DSC) as x
答案 0 :(得分:0)
它不能在子查询中,所以将其移出:
INSERT INTO dbo.DimProduct
(
[ProductKey]
,[ProductCode]
,[ProductCode]
,[ProductName]
,[ProductWaterfallGroupKey]
,[InsertExecutionID]
,[UpdateExecutionID]
,[DisplayOrder]
)
select NEXT VALUE FOR DBO.SQ_WATERFALL_PROD, x.*
from (
select distinct *
ProductCode = c.ResourceNo
,ProductCode = c.ProductID
,ProductName = p.[Product_NM]
,w.ProductWaterfallgroupkey
,InsertExecutionID = 0
,UpdateExecutionID = 0
,DisplayOrder = 0
FROM targit_Updated.[dbo].[FS_ContractTypeProduct_D] c
LEFT JOIN [DWSF].[dbo].[SF_Product_D] p ON c.ProductID = p.[Product_ID] COLLATE Latin1_General_CS_AS
JOIN #ProdWaterfallGrouping w on w.ReportingGroup= p.Reporting_Group_DSC) as x