I'm trying to use a stored procedure to do an insert on a main table, then also insert that data into a historical data table. I don't want to use a trigger, but rather just do a simple insert of all columns into the history table. I am getting this error, however.
"An explicit value for the identity column in table 'ipaudittrail' can only be specified when a column list is used and the IDENTITY_INSERT is on."
I imagine this has to do with Scope_Identity()? but I'm not well-versed in SQL, so I'm not really sure the best way to resolve this. Any suggestions are appreciated. Thanks!
Insert Input
(OpenedByName, Owner, Description, WorkOfDate)
Values
(@vOpenedByFirstName, @vOwner, @vDescription, @vWorkOfDate)
Set @vRecID = Scope_Identity()
Insert InputAuditTrail
Select *
From Input
Where RecID = @vRecID
Select *
From Input
Where i.RecID = @vRecID