Tuesday, July 24, 2012

Create a Comma-Delimited List Without Using a Cursor

Cursors in SQL Server are used to process a complete set of rows one by one. Cursors are much slower and we should avoid using Cursors.

Use below query to create comma-delimited list without th use of a Cursor:


SELECT @CardIDIDs = ISNULL(@CardIDIDs + ',', '') + [CardID] FROM CustomerMaster


No comments:

Post a Comment