Tip Of The Day - DOTNET

Tip Of The Day

  1. Create a primary key on each table you create and unless you are really knowledgeable enough to figure out a better plan, make it the clustered index (note that if you set the primary key in Enterprise Manager it will cluster it by default).
  2. Create an index on any column that is a foreign key. If you know it will be unique, set the flag to force the index to be unique.
  3. Don’t index anything else (yet).
  4. Unless you need a different behaviour, always owner qualify your objects when you reference them in TSQL. Use dbo.sysdatabases instead of just sysdatabases.
  5. Use set nocount on at the top of each stored procedure (and set nocount off) at the bottom.
  6. Think hard about locking. If you’re not writing banking software, You can use the NOLOCK hint, but it’s often easier to use SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED at the top of the procedure, then reset to READ COMMITTED at the bottom.
  7. I know you’ve heard it a million times, but only return the columns and the rows you need.
Copyright © 2015 DOTNET All Right Reserved