我正在嘗試在Projectdetails中創建一列EAC。 表1:Projectdetails] 表2: 'RAC']插入並選擇
(SELECT b.[EAC] FROM [dbo].[Projectdetails] a
INNER JOIN [dbo].['RAC'] b ON a.[ProjectKey]= b.[Project _ID])
正常工作並返回我421行。
但是下面的查詢不起作用:
Insert into [dbo].[Projectdetails]([EAC])
(SELECT b.[EAC] FROM [dbo].[Projectdetails] a
INNER JOIN [dbo].['RAC'] b ON a.[ProjectKey]= b.[Project _ID])
返回我不能插入NULL值插入列ProjectKey
只是可以肯定我的理解 - 你試圖添加和填充'EAC'列到現有的行,對不對? – Mureinik 2014-12-27 16:10:04
嘗試運行'(SELECT b。[EAC] FROM [dbo]。[Projectdetails] a INNER JOIN [dbo]。['RAC'] b ON a。[ProjectKey] = b。[Project _ID] WHERE b.EAC IS NULL)'。如果您發現至少有一條記錄,那麼就有您的問題 – dotnetom 2014-12-27 16:10:15