Go to home page mail me! RSS Feed

September 2009 Entries

Concatenating multiple rows into single column in SQL Server

Sometimes you need to return a single column that contains values that are comma separated or pipe separated or what ever floats your boat from a multiple row result set, a perfect example is returning the category id’s for a product that could be in one of more categories but you don’t want to return multiple rows with duplicate information. There are two ways of doing this or two that I know of – meaning simple enough. 1. The COALESCE method, which is probably the most common. This method works by tricking the coalesce function into doing something...

posted @ Tuesday, September 29, 2009 3:44 PM | Feedback (3)

Next entries »