The MSDN documentation for sp_getapplock says:
[ @Resource= ] 'resource_name' Is a string specifying a name that identifies the lock resource.
The lock resource created by sp_getapplock is created in the current database for the session. Each lock resource is identified by the combined values of:
- The database ID of the database containing the lock resource.
- The database principle specified in the @DbPrincipal parameter.
- The lock name specified in the @Resource parameter.
My questions:
1. is the 'resource_name' just any old name you make up?
2. does the 'resource_name' have to refer to a table name or stored proc name or a (named) transaction name?