SQL Server:向表中插入记录计数

时间:2014-02-14 10:39:13

标签: insert count sql-server-2012

我正在尝试插入一个计数,但我得到了错误

  

关键字“SET”附近的语法不正确。

我是以错误的方式解决这个问题吗?

INSERT INTO Timestamp_ActiveReferralscopy
   SET count = (select count(HashID) 
         from [dbo].[T_PTID]
   where date_of_Death is null AND Deduction_Date is null)

1 个答案:

答案 0 :(得分:1)

这就是你要找的东西吗?

    INSERT INTO Timestamp_ActiveReferralscopy (count)
    select count(HashID) from [dbo].[T_PTID]    
    where date_of_Death is null AND Deduction_Date is null

...