sp_tempdb bind binds a login or application to a local temporary database or database group. For example, to bind the “sa” login to the default group, enter:
sp_tempdb "bind", "LG", "sa", "GR", "default"
To bind isql to local_tempdb1 on ase1, enter:
sp_tempdb "bind", "AP", "isql", "DB", "local_tempdb1"
sp_tempdb unbind removes one or more bindings. For the Cluster Edition, this command includes an instance_name parameter that lets you drop the binding to a particular local temporary database.
For example, to unbind isql from local_tempdb2on “ase2”, enter:
sp_tempdb "unbind", "AP", "isql", NULL, "ase2"
If isql is bound to a database group,
the above command removes the binding for the group. If multiple
database bindings exist for isql, the above command
removes only the binding for “ase2”; bindings
to temporary databases on other instances are unaffected.
To unbind a user login or application from a database group or any temporary databases, use the unbind parameter with only the login or application name. For example, to remove the binding for the "sa" login:
sp_tempdb "unbind", "lg", "sa"
To unbind all logins and applications to a particular group, use sp_tempdb unbindall_gr. For example, to remove all bindings to tempdbgroup1, enter:
sp_tempdb "unbindall_gr", "tempdbgroup1"
To unbind all login and application bindings to a particular database, use sp_tempdb unbindall_db. For example, to unbind all bindings to localtempdb1, enter:
sp_tempdb "unbindall_db", "localtempdb1"