• I Goggled about "sp_getapplock"

    This approach has some downsides

    1) Other users can’t SELECT from the table.

    2) If you rebuild indexes on the table with the “online=on” option, it will want to put a schema lock on the table, to prevent other schema changes. The exclusive lock prevents the rebuild from starting.

    sp_getapplock is the built-in way to allow only one user in a section of code at a time.

    Is it right option as my requirement is; When one user insert or update records in database, other user can select records from database but can't insert or update at that time.