TableA ID Address Location Country 1 NULL Region1 Austrailia 2 NULL Region2 Antartica 3 NULL Region3 Egypt TableB ID Address Name 1 test avenue james 2 test avenue 2 jessica 3 test avenue 3 joshua
I am working on a query to migrate data Address data from Database 1, TableB to Database 2 TableA. So far I have tried to do the query below however that only inserts one record for the entire database, I want to insert each new sequential address into TableA as it appears in TableB.
UPDATE [dbo].[TableA] SET [dbo].[TableA].[Address]= Table2.ID FROM (SELECT [TableB].[ID] FROM [TableB]) AS Table2 WHERE [dbo].[TableA].[ID] <= 1449
This results in all records only having the first ID which is 1, so all the rows in TableA are Address = 1, instead of 1,2,3 etc. I think I am close but not quite sure what I am missing
TableA ID Address Location Country 1 1 Region1 Austrailia 2 2 Region2 Antartica 3 3 Region3 Egypt