sqlserver 获得行号作为唯一id

当sqlserver创建的view没有唯一的标识字段里,entity framework codefirst配置会出现错误,因为取其行号作为唯一标识列

CREATE VIEW [SafeWatch].[MissionInvalidItemView]
AS
SELECT ROW_NUMBER() OVER(ORDER BY aci.Id ASC) AS RowNumber,
ac.AppCheckItemId,

FROM SafeWatch.AppCheck ac
INNER JOIN SafeWatch.AppCheckItem aci ON aci.Id = ac.AppCheckItemId
LEFT JOIN SafeWatch.MissionInvalidItem mii ON mii.AppCheckId = ac.Id
WHERE ac.CheckResult>1

GO

上一篇:POJ 1679 The Unique MST (最小生成树)


下一篇:Sqlserver获取行号