I am creating a node.js server using express. I am using mssql and sqlstring to query my SQL server. For one of my functions, I want to update some data within my 'records' column, however in certain cases, it only updates half of the information and in others, it works perfectly. Here is my current setup:
I created a temporary table #current_samples
and have added the columns:
record_id int,
is_positive bit,
time_of_test datetime2(7)
I am trying to create a temporary table with the new information, then update the records table with the temporary table.
Here is my SQL command I use after creating my temporary table:
UPDATE records SET records.time_of_test = c.time_of_test, records.is_positive = c.is_positive FROM records INNER JOIN #current_samples c ON (records.record_id = c.record_id)
I have checked to make sure my temporary table is correctly adding the columns, and it is. My issue is UPDATE
sometimes works perfectly, and other times only updates HALF of the information.
Thanks in advance!