SQL Server 2008 - Worth the Wait
SELECT CustomerID, CustomerFirstName, City This technique results in reduced disk I/O and better performance.
SELECT CustomerID, CustomerFirstName, City
This technique results in reduced disk I/O and better performance.
If a cursor is unavoidable, use a WHILE loop instead. I have personally tested and concluded that a WHILE loop is always faster than a cursor. But for a WHILE loop to replace a cursor you need a column (primary key or unique key) to identify each row uniquely. I personally believe every table must have a primary or unique key. Click here to see some examples of using a WHILE loop.