Hi.
I have to insert several records in a table called detallelibrobancos and by each one create another record in table detalleconciliacion.
If for example I insert a record in detallelibrobanco and it gives me the identity 20. This identity 20 must be inserted in detalleconciliacion in the field iddetallelibrobanco. Then If I insert another record in detallelibrobanco and it gives me the identity 21, This identity 21 must be inserted in detalleconciliacion in the field iddetallelibrobanco.
How can I do?
Thanks.
--Insercion de los movimientos DECLARE @IdDetalleLibroBanco INT INSERT INTO Tesoreria.DetalleLibroBancos ( IdLibroBanco , IdOpBancaria , ) SELECT @IdLibroBanco , IDOPBANCARIA from test) ) SELECT @IdDetalleLibroBanco = SCOPE_IDENTITY() --Insercion en Tesoreria.DetalleConciliacion INSERT INTO Tesoreria.DetalleConciliacion ( IdOpBancaria , IdDetalleLibroBanco ) VALUES ( IdOpBancaria @IdDetalleLibroBanco )