Archive

Archive for the ‘Procedures’ Category

Changing SQL database to single user mode and back to Multi User mode

October 26th, 2010 admin No comments

It is often necessary to change the database to single user mode, especially if you are a DBA. A simple example would be to change the collation settings or any DB settings. The single user will allow only one  user ( usually DBA) to access the database. Hence it will be easy to make changes without the worry of deadlocks or any other type of contention for DB and also without affecting the users.

It is very easy to change the database to Single user mode; in fact, it is just an execution of the script away. Use the script below to change the mode.

ALTER  DATABASE <<Database Name>>  SET SINGLE_USER  WITH NO_WAIT

Read more…

Encrypt the stored procedures to hide details from users

October 11th, 2010 admin No comments

Encrypting a stored procedure will hide the definition of the procedure from users and it definition will not be displayed in the activity monitor.

The procedures can be encrypted by using “WITH ENCRYPTION” clause after the create statement.

ex: Read more…