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.
DECLARE @CardIDIDs VARCHAR(MAX)
SELECT @CardIDIDs = ISNULL(@CardIDIDs + ',', '') + [CardID] FROM CustomerMaster
SELECT @CardIDIDs
Use below query to create comma-delimited list without th use of a Cursor:
SELECT @CardIDIDs = ISNULL(@CardIDIDs + ',', '') + [CardID] FROM CustomerMaster
SELECT @CardIDIDs
No comments:
Post a Comment