Hello, I realise my last question on this subject wasn't very clear so here is some sample code that explains what I want to do:--This is an example of the old database data with strange ids.DECLARE @OldDataBaseTable TABLE( Id char(5), OtherData varchar(50), EntryDate datetime)INSERT INTO @OldDataBaseTableSELECT 'A1000','Some data',getdate()UNION ALLSELECT 'A1001','Some different data',getdate()UNION ALLSELECT 'B1000','Some of the same data',getdate()UNION ALLSELECT 'A2000','Some of the same data',getdate()--this is the new database table with identity generated ids (has other datasources besides old database)DECLARE @NewDatebaseTable TABLE( Id int identity(1,1), OtherData varchar(50), EntryDate datetime)--Stores old to new idsDECLARE @OldtoNewIds TABLE( New_Id int, OldId char(5))--inserts data into new database from oldINSERT INTO @NewDatebaseTable(otherdata,entryDate) OUTPUT INSERTED.Id, Null --This should be O.Id, but it wont work INTO @OldtoNewIdsSELECT O.OtherData,O.EntryDateFROM @OldDataBaseTable O --This table should be the new ids next to the old onesSELECT * FROM @OldtoNewIds
Does anyone know how to do this? Thanks!