I have a table in production DB with ID int identity (1,1). I am trying to add new data to it via SSIS but the table in STG has also the same int identity (1,1) which starts from 1 and I need to start from the max id from the table in DB production. Then I have a merge script that inserts new data upon id How should approach this?
I have try: I have tried to change the store procedure:
CREATE PROCEDURE spmaxid
as
BEGIN
SELECT max([ID])
FROM [Production].[dbo].[UNITS]
END
then this:
UPDATE [dbo].[STG UNITS] SET id = NULL
GO
DECLARE @id INT
SET @id = Spmaxid
UPDATE [STG].[dbo].[STG UNITS]
SET @id = id = @id + 1
GO
SELECT * FROM [STG UNITS]
GO