PurpleUnicorn
Programmer
I have an Access database(B/E) that I am in the process of migrating to SQL Server. I currently have sample data in SQL Server and I am testing my Access F/E.
I have a delete trigger that is firing correctly - however, I am not getting the error message from my Access F/E.
Here is my trigger:
ALTER Trigger [CUSTOMERdelete] on [dbo].[CUSTOMER]
for delete
as
BEGIN
declare
@errorNumber int,
@errorMsg varchar(255)
if exists(
select * from deleted, ORDERS where ORDERS.CUSTOMER_ID = deleted.CUSTOMER_ID)
begin
select @errorNumber = 30004,
@errorMsg = 'Cannot delete from CUSTOMER because ORDERS exists.'
goto errorHandler
end
return
errorHandler:
raiserror @errorNumber @errorMsg
rollback transaction
END
GO
I have a delete trigger that is firing correctly - however, I am not getting the error message from my Access F/E.
Here is my trigger:
ALTER Trigger [CUSTOMERdelete] on [dbo].[CUSTOMER]
for delete
as
BEGIN
declare
@errorNumber int,
@errorMsg varchar(255)
if exists(
select * from deleted, ORDERS where ORDERS.CUSTOMER_ID = deleted.CUSTOMER_ID)
begin
select @errorNumber = 30004,
@errorMsg = 'Cannot delete from CUSTOMER because ORDERS exists.'
goto errorHandler
end
return
errorHandler:
raiserror @errorNumber @errorMsg
rollback transaction
END
GO