Current database error creating triggers

  • I'm trying to create triggers to update a linked MySQL database using the DSN my_mysql. My code is:

    create trigger items_insert on test2.dbo.names

    for insert

    as

    set xact_abort on

    insert into openquery(my_mysql, 'select * from names')

    select id, name, age from inserted

    go

    create trigger items_update on test2.dbo.names

    for update

    as

    set xact_abort on

    delete from openquery(my_mysql, 'select * from names')

    where id in (select id from deleted)

    insert into openquery(my_mysql, 'select * from names')

    select id, name, age from inserted

    go

    create trigger items_delete on test2.dbo.names

    for delete

    as

    set xact_abort on

    delete from openquery(my_mysql, 'select * from names')

    where id in (select id from deleted)

    go

    This produces the error:

    Cannot create trigger on 'test2.dbo.names' as the target is not in the current database.

    Can anyone explain this?

  • Cannot create trigger on 'test2.dbo.names' as the target is not in the current database.

    You need to be in the context of your test2 database when you execute the create trigger statement.

    You could put this at the top of your script:-

    use test2

    go

  • Ok thanks, now I get the error:

    The requested operation could not be performed because the OLE DB provider ‘MSDASQL’ does not support the required transaction interface

    I've heard that this can be fixed in the provider options for MSDASQL, but I can't find these options anywhere in SQL Server Express. Are these features missing from the express version?

    How can I set it to accept transacted updates?

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply