• Offhand, I'd suggest trying a DDL trigger on the CREATE DATABASE event (note that attaching fires 'CREATE DATABASE ... FOR ATTACH'), and see if that catches it.

    If so, you can call whatever code you like when it occurs.

    Link to Books Online topic:

    https://msdn.microsoft.com/en-us/library/ms190989%28v=sql.100%29.aspx

    -Eddie

    Eddie Wuerch
    MCM: SQL