I am a DBA + .Net developer. I got certified in SQL 2005 and .Net 1.1. I would like to share with you that the stored procedure offers much more functions than LINQ
1. Use of Lock Hint.
2. Control of deadlock free query in stored procedure. Writing deadlock free query requires the queries to be runnning in "specific order" between several tables
3. Use of recursive SQL with CTE
4. Use of SQL 2008 new data type such as hierachyID, spatial datatype
5. You can assign a query plan to a specific query or specify query hint. It can solve the Parameter sniffing issue. In SQL 2008, the FORSEEK option helps a lot
6 You want to do a SELECT sql using ORDER BY COLLATE the column by different collation in sql. This important especially working with 2 different db with 2 different collation. Especially in different language, the sorting order is different. Example: Try adventureworks
SELECT LastName, FirstName FROM Person.Contact
WHERE LastName LIKE 'R%'
ORDER BY FirstName COLLATE Latin1_General_CI_AS DESC, LastName DESC
For case sensitive search
SELECT LastName, FirstName FROM Person.Contact
WHERE LastName COLLATE Latin1_General_CS_AS LIKE 'r%' (NO RESULT DUE TO CASE SENSITVE)
7, Update 800+rows at a same time using OPEN XML. I have an application updating payroll hours for 300+ employees. Use of OPEN XML took a split seconds, use of seperate insert statement took at least 3 seconds
8 There has been complaints about paging millions of records using LINQ. In sql server, use of temp table and temp table variables in paging are very subtle. The performance differs from case to case
9 Use of PIVOT table
10 Use of Encryption function
Wednesday, 4 March 2009
Subscribe to:
Posts (Atom)