Update Table

Hi There,
I have been trying all weekend to do this but can't.
I have a .csv file with 1 column / field that contains a number.
For each row in the csv I need use the number to get the corresponding record in a table called WorksReq.
Once I have the WorksReq record I need to get around 4 field values and use those value to add a record to a table called PartsReq.
Could someone please help me to do that.

Thanks for your help.

Best Regards,

Have you imported the .csv file into a table?

Hi There,
Thanks for the reply.

No I have not imported into a table.

Best Regards,

I think djj55 is probably onto the right path here.

I would personally import the file into a holding table in the database (call it import for want of a better name), then you can simply query the database tables against the import table to get the results you need. Just remember to empty the import table at the beginning of each new import to ensure you only query for the results you want.

is this a one time process or a continuous process you will be scheduling to run ?

Hi There,
Hopefully it's a 1 time thing.
For some reason records are missing from a table and I am trying to repair it.

Best Regards,

Worth considering:

Restore a backup to a new, temporary, database name.

IF (hopefully!!) your database is in Full Recovery Model and you have LOG backups, then use those to restore to point-in-time just/shortly before the data was "lost"

"Copy" the missing rows (or columns, within rows) back to the live database (i.e. use INSERT and/or UPDATE and join the tables in TEMP and Live databases)

DROP the TEMP database when you are done.