Hello,
How can I insert these parameters into another table in another db using a stored proc? Making sure that both id's are not duplicated?
Thank you.
How can I insert these parameters into another table in another db using a stored proc? Making sure that both id's are not duplicated?
Code:
ALTER PROCEDURE [dbo].[pUpdateAn]
@Parameters...
set nocount on
declare @NextId int
declare @RowCnt int
if (@Action = 0 )
begin
Select @AnotherId = @AnId
update Something set Something_Nm = @SomethingNm, This_Nm = @ThisNm, Active_Fl = @ActiveFl, Location_Id = @LocationId,
Address1_An = @Address1An, Phone_An = @PhoneAn, Mail_An = @MailAn, Type_Cd = @Type,
Brand_Cd = @BrandCd, Group_Cd = @GroupCd, ship_Cd = @shipCd,
People_Nr = @PeopleNr, Building_Nr = @BuildingNr, Site_Cd = @SiteCd, Rate_Nr = @RateNr
where An_Id = @AnId
end
if (@Action = 1 )
begin
select @AnotherId = max(An_Id) + 1 from An
insert into An
(An_Id, Something_Nm, Active_Fl, Location_Id, This_Nm, Address1_An, Phone_An, Mail_An, Type_Cd,
Brand_Cd, Group_Cd, Ship_Cd, People_Nr, Building_Nr, Site_Cd, Rate_Nr )
values (@NextId,@AnNm, @ActiveFl,@LocationId, @ThisNm, @Address1An, @PhoneAn, @MailAn, @Type,
@BrandCd, @GroupCd, @ShipCd, @PeopleNr, @BuildingNr, @SiteCd, @RateNr)
-->Here is where I'd like to place my stored proc <--
exec pUpdateAnotherTable...
end
Thank you.