1 2 /* Stored procedure for adding or modifying lock promotion attribute.
3 ** Database attributes can only be modified when using Master.
4 */5 6 /*
7 ** Messages for "sp_setrowlockpromote"
8 **
9 ** 17260, "Can't run %1! from within a transaction."
10 ** 17421, "No such database -- run sp_helpdb to list databases."
11 ** 17460, "Object must be in the current database."
12 ** 18090, "The target object does not exist."
13 ** 18158, "At least one of the parameters 'new_lwm', 'new_hwm' or 'new_pct' must be non-NULL to execute this procedure."
14 ** 18159, "You must be in the 'master' database to add, change or drop lock promotion attribute for a user database."
15 ** 18160, "Please specify a non-NULL value for %1, since it has not been set previously with a non-NULL value."
16 ** 18161, "Object name parameter must be NULL for Server-wide lock promotion attributes. Using NULL instead of - %1."
17 ** 18162, "'%1!' is a not a user table. '%1' can be used only on user tables."
18 ** 18163, "The lock promotion LWM value %1 cannot be greater than the lock promotion HWM value %2."
19 ** 18164, "Invalid value specified for 'scope' parameter. Valid values are 'SERVER','DATABASE' or 'TABLE'."
20 ** 18165, "The 'lock promotion!' attributes of %1 '%2' have been changed. The new values are %3."
21 ** 18338, "Invalid obj_type parameter: '%1!'. Please specify 'PAGE' or 'ROW'."
22 */23 24 createproceduresp_setrowlockpromote25 @scope varchar(10),/* table, database or server */26 @objname varchar(767)=NULL,/* table or database name */27 @new_lwm int =NULL,/* Lock promotion lwm value */28 @new_hwm int =NULL,/* Lock promotion hwm value */29 @new_pct int =NULL/* Lock promotion pct value */30 as31 32 declare@status int
33 34 exec@status=sp_setlockpromote "ROW",@scope,@objname,35 @new_lwm,@new_hwm,@new_pct36 return(@status)37
exec sp_procxmode 'sp_setrowlockpromote', 'AnyMode'
go
Grant Execute on sp_setrowlockpromote to public
go