Displays or changes the execution modes associated with stored procedures.
sp_procxmode [procname [, tranmode]]
sp_procxmode
procedure name user name transaction mode ------------------ --------- ---------------- byroyalty dbo Unchained discount_proc dbo Unchained history_proc dbo Unchained insert_sales_proc dbo Unchained insert_detail_proc dbo Unchained storeid_proc dbo Unchained storename_proc dbo Unchained title_proc dbo Unchained titleid_proc dbo Unchained
sp_procxmode byroyalty
procedure name transaction mode ------------------------------ ---------------- byroyalty Unchained
sp_procxmode byroyalty, "chained"
sp_procxmode "otherdb.otheruser.newproc", "chained"
To use sp_procxmode, turn off chained transaction mode using the chained option of the set command. By default, this option is turned off.
When you use sp_procxmode with no parameters, it reports the transaction modes of every stored procedure in the current database.
sp_procxmode procname
sp_procxmode procname, tranmode
You can execute “chained” stored procedures only in sessions using chained transaction mode.
You can execute “unchained” stored procedures only in sessions using unchained transaction mode.
To execute a particular stored procedure in either chained or unchained sessions, set its transaction mode to “anymode”.
If you attempt to run a stored procedure under the wrong transaction mode, the SAP ASE server returns a warning message, but the current transaction, if any, is not affected.
Executing sp_procxmode procname, 'Dynamic Ownership Chain' makes sure that any Dynamic SQL (execute immediate) statements within the stored procedure get their permissions checked against the procedure creator.
Executing sp_procxmode procname, 'No Dynamic Ownership Chain' (the default behaviour if omitted) makes sure that any Dynamic SQL (execute immediate) statements within the stored procedure get their permissions checked against the procedure executor.
begin transaction, commit, save transaction, set in Reference Manual: Commands
The permission checks for sp_procxmode differ based on your granular permissions settings.
Setting | Description |
---|---|
Enabled | With granular permissions enabled, you must be the owner of the procedure or a user with manage database privilege. Any user can execute sp_procxmode to for its own procedure. |
Disabled | With granular permissions disabled, you must be the database owner, the owner of the procedure, or a user with sa_role. Any user can execute sp_procxmode to display the transaction mode. |
Values in event and extrainfo columns from the sysaudits table are:
Information | Values |
---|---|
Event | 38 |
Audit option | exec_procedure |
Command or access audited | Execution of a procedure |
Information in extrainfo |
|