Tagged with " competition"
10 Jan
2007
Posted in: Thoughts
By    No Comments

Learning never dies

To followup with my post on SQL Tip – Row-by-row processing (http://blogs.abrahamdurairaj.info/2006/12/sql-tip-row-by-row-processing.html) I have learnt a cool technique offlate.

It is the use of COALESCE function in SQL server. You can use this function to get quicker progress in fetching & processing records row-by-row.

Quick Sample

DECLARE @EmployeeList varchar(100)

SELECT @EmployeeList = COALESCE(@EmployeeList + ', ', '') +
CAST(Emp_UniqueID AS varchar(5))
FROM SalesCallsEmployees
WHERE SalCal_UniqueID = 1

SELECT @EmployeeList

Info. Source
http://www.sqlteam.com/item.asp?ItemID=2368