If issued in the context of a migrated task, migrate_instance_id returns the instance ID of the instance from which the caller migrated. If issued in the context of a nonmigrated task, migrate_instance_id returns the ID of the current instance.
migrate_instance_id()
You may issue migrate_instance_id from a login trigger to determine which statements in the trigger should be executed in case a task is migrated.
ANSI SQL – Compliance level: Transact-SQL extension.
You must be the system administrator to issue migrate_instance_id.