SoupOfStars
SoupOfStars

Reputation: 147

SQL Server : Insert into table a count of records

I'm trying to insert a count but I get and error

Incorrect syntax near the keyword 'SET'.

Am I going about this the wrong way?

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

Upvotes: 0

Views: 4730

Answers (1)

wribit
wribit

Reputation: 595

is this what you're looking for?

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

....

Upvotes: 1

Related Questions