1. The simplest guidance is do not create the stored procedure with prefix "sp_". I prefer to create the procedures with a convention like <projectabbreviation_spProcedureName>.
2. Include the SET NOCOUNT ON statement as the first statement of the procedure.
3. Do not write "Select count(*) from Table" statement to get the count of the records. Alternatively, use "Select count (PrimaryKeyColumn) from Table".
4. Try to avoid dynamic SQL queries as much as possible.
5. Prefer to have the table variables instead of temp tables. Keep minimal use of temp tables.
6. Avoid the use of the cursors to loop through the records. Instead keep the records in the table variable or temp tables.
Use schema name with an object name.
7. Prefer table joins over the use of subqueries in the where conditions.
8 Transfer the relevant records from the primary tables to the table variable and do further processing with the table variable, thereby disconnecting the primary tables reference.
9. Try to avoid using NOT LIKE operator.
10.Create Non-clustered indexes, wherever it is necessary
11. Use the sp_executesql stored procedure instead of the EXECUTE statement.
12. Create views for repeatedly used select queries.
13. Keep only the required columns as part of the final SELECT query instead of saying "SELECT * FROM..".
14 Instead of keeping a very large stored procedure, try to break it into smaller sub-procedures, wherever possible.
15 When you fetch the records from the stored procedure and display in the grid format on the front-end, prefer to have custom paging logic when the underlying results set contains many records.
Subscribe to:
Post Comments (Atom)
Followers
Link
Labels
Agille
(3)
Angular 2
(96)
Architecture
(7)
ASP .Net
(30)
C#/VB .Net
(161)
Entityframework
(11)
General
(33)
Git
(2)
Hosting
(2)
HTML
(4)
Interview
(12)
Interview-Agile
(1)
Interview-Angular
(25)
Interview-ASP .Net
(3)
Interview-C#
(16)
Interview-JavaScript
(1)
Interview-MVC
(30)
Interview-SQL Server
(4)
Interview-WCF
(2)
Islam
(6)
Java Script
(37)
JQuery
(1)
MVC
(53)
NodeJS
(1)
Puzzles
(1)
React-Native
(3)
Security
(1)
Shayri
(10)
SQL Server
(41)
VC++
(5)
WCF
(21)
Web API
(27)
WPF
(21)
No comments:
Post a Comment