General tips for coding and SQL server

This article explained about the general tips for coding and SQL server. It helps to improve your technical aspects in an optimized way. To improve the speed of the application and 80% to 90% of quality assurance we have to follow these steps which is mentioned in this article.

1) While writing a SQL query with join conditions, we have to use JOIN to the appropriate tables. Parent table must join with child table. Here parent table refers (Which tables data required more fields).

2) All the Stored procedure must have only one mode with the proper query alignments. Also, need proper description about each SQL queries. Your query should align the following format,

SELECT Field1,
FROM tableName T
INNER JOIN tableName2 T2 ON T1.Field1 = T2.Field1
WHERE T.Field4 = 6
T.IsActive = 1

So that, any other programmer can easily understand our query.

3) Avoid sub queries most of the time. If it is not possible to avoid this, then write a separate SQL function and write your query.

4) In your C# code, all the variables must declare as follows,

Integr - > iAccountNumber

Double -> dPrice

DateTime - dtCreatedDate

Bool -> bIsActive

Object -> objUserDetail

List<ObjecT> -> lstOnlineUsers

Class fie -> BLUser

DataSet -> dsUserInfo

DataTable -> dtabUser

Label -> lblName

TextBox -> txtControl

DataList -> dlstUsers

Repeater -> rptrUsers

var -> tName

Generally, all the programmers are follows the basic coding standards. Here, the coding standards is easy to get the variables by other programmers. For example, a programmer create a variable like UserName but when another programmer thoughts it must be a NickName or ProfileName or any other. So, it's not guess by others. All the programmers know that's a string datatype. If we use this kind of standard, then a programmer can type s in their .NET it will listouts all the string variables first. So that, programmer can easily pick the suitable one.

5) Use always class and generic list. Avoid dataset. Because, filter can easily performed in generic list rather than dataset.

6) Before start the task do the following steps,

a) Get full requirement about the task

b) Write a steps in your notepad, what are the steps you are going to do for that task

c) Apply some input data to your steps and get the proper output for each step

d) Discuss all of these steps to your leader and get suggestions

e) Write the same steps in your code

7) If you are doing more than one projects, then do not prioritize the task by yourself.


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: