-- "Update CitationName field from file.sql"
-- 
--
-- Import csv file 'NewCitName.csv' into temp table ModCitationNameField
-- CSV file has 2 columns - CitationID,CitationName - and no headers.
-- 
--
;
CREATE VIRTUAL TABLE temp.ModCitationNameField USING csv(filename='C:\Users\Admin\Desktop\RootsMagic\SQL-RM8\NewCitName.csv');

--use new values to update the CitationTable
UPDATE CitationTable
SET CitationName = (SELECT TRIM(c1)
       FROM ModCitationNameField
       WHERE CitationTable.CitationID=c0)
WHERE
   EXISTS (
       SELECT *
       FROM ModCitationNameField
       WHERE CitationTable.CitationID=c0
   )
;
