Monday, April 14, 2008

Tips and Tricks for using SQL SERVER

Tips and Tricks for using SQL SERVER

1.Store relevant and necessary information in the database instead of application structure or array.
2.Use normalized tables in the database. Small multiple tables are usually better than one large table.
3.If you use any enumerated field create look up for it in the database itself to maintain database integrity.
4.Keep primary key of lesser chars or integer. It is easier to process small width keys.
5.Store image paths or URLs in database instead of images. It has less overhead.
6.Use proper database types for the fields. If StartDate is database filed use datetime as datatypes instead of VARCHAR(20).
7 Use Like Clause properly, if you are looking for exact match use '=' instead.
7.Specify column names instead of using * in SELECT statement.
9.Write SQL keyword in capital letters for readability purpose.
10.Using JOIN is better for performance then using sub queries or nested queries.
11.Use stored procedures. They are faster and help in maintainability as well security of the database.
12.Use comments for readability as well guidelines for next developer who comes to modify the same code. Proper documentation of application will also aid help too.
13.Proper indexing will improve the speed of operations in the database.
14Make sure to test it any of the database programming as well administrative changes.

1 comment:

Kamal Jindal said...

Your blog is so good and filled with interesting things that its a daily task for me to take a peek at for new posts! Keep it up!