I am testing the trigger listed below to update another database:
CREATE TRIGGER [ESP_Global_Quote_Table] ON [oe_hdr]
FOR INSERT
AS
/*
The trigger will enter order number and item id into the quote table in
GlobalOpp database on ESP12.
*/
declare @order_no as varchar(8)
select @order_no = order_no from inserted
if @@ROWCOUNT <> 0
Begin
declare @item_id as varchar(40)
SELECT @item_id = item_id, @order_no = order_no
FROM p21_order_view where order_no = @order_no
IF @@ROWCOUNT <> 0
RETURN
BEGIN
insert into ESP12.GlobalOpp.dbo.Quotes (order_no, item_id) values (@order_no, @item_id)
END
End
It is currently on the same server (ESP12), but I am still getting that the domain user is not a valid user for the database GlobalOpp. I have tried putting my username in for the Users, and Domain Users is in there also. I have set permissions for both, but I still get this error.
In the end, I am going to move this to the production server which is different. I did see that I would need to create a job to do this, but I can't figure out how to transfer the value of the order number to the job. Any help would be greatly appreciated. Thanks!
CREATE TRIGGER [ESP_Global_Quote_Table] ON [oe_hdr]
FOR INSERT
AS
/*
The trigger will enter order number and item id into the quote table in
GlobalOpp database on ESP12.
*/
declare @order_no as varchar(8)
select @order_no = order_no from inserted
if @@ROWCOUNT <> 0
Begin
declare @item_id as varchar(40)
SELECT @item_id = item_id, @order_no = order_no
FROM p21_order_view where order_no = @order_no
IF @@ROWCOUNT <> 0
RETURN
BEGIN
insert into ESP12.GlobalOpp.dbo.Quotes (order_no, item_id) values (@order_no, @item_id)
END
End
It is currently on the same server (ESP12), but I am still getting that the domain user is not a valid user for the database GlobalOpp. I have tried putting my username in for the Users, and Domain Users is in there also. I have set permissions for both, but I still get this error.
In the end, I am going to move this to the production server which is different. I did see that I would need to create a job to do this, but I can't figure out how to transfer the value of the order number to the job. Any help would be greatly appreciated. Thanks!