Last Execution Time Of A Stored Procedure

Sometime it is a critical question that when a stored procedure is run. Because if you want to drop a stored procedure which is not used any more, you must be sure that it is not used.

Shrink Database Files By Small Amount

It is not recommended to shrink database files. But sometimes it becomes necessary to shrink a database file. Because it is not needed that much free space any more.

Stop processing a batch which is separated with 'GO'


If you have batch scripts which is separated with 'GO' statement, it is not easy to stop processing the rest of the script in case of an error.

Randomize Selection Order

Sometimes it is a need to select random rows from a table or view. You can use NEWID() function to order rows randomly. Here is the code.

Generate Database Script Permissions


Some times DBAs get tired of slavery work. One of them is generating database script with management studio.

Can not rebuild online, then reorganize it.

If an index cannot be rebuilt online you can reorganize it.

Clustered index keys must not be used as include column

Mostly of tables have a clustered index. In addition, non-clustered indexes also created in need. To improve index performance, some columns may be included to non-clustered index.

How to decide clusted index key set


Generally speaking it is said that every table must have a clustered index. But selecting index key set for clustered index is not easy.