I need to add about 600 records from one database to another one.
The first part inserts from a select like this:
INSERT INTO RelayMapper.dbo.radioSignals(CstarID, StarName, SystemName, StarSystemCount, SuperNova, DateCreated)
SELECT NEWID(), startName, systemName, 1, 1, getDate()
FROM AISourceMapper.dbo.radioSignals
WHERE rangeICW = 5
This is where it gets tricky and I don't know how to do it.
So for each row inserted above, I need to also insert related data into another table.
The NEWID()
above would be used to insert a row and then I'd need to insert the starCoordinates
as well from AISourceMapper.dbo.radioSignals
and it would look something like this:
INSERT INTO RelayMapper.dbo.radioSources(CstarID, starCoordinates, isVerified)
VALUES('1150C651-5D9A-4C13-9BE7-EF4AZ2549112', 'R.A. 13h 27m, DEC. -47deg, 29m', 1)
starCoordinates
is also from the same table and row that I'm SELECTing from(AISourceMapper.dbo.radioSignals)
Is there a way to do something like this?