Reputation:
I have a select statement and a cursor to iterate the rows I get. the problem is that I have many columns (more than 500), and so "fetch .. into @variable" is impossible for me. how can I iterate the columns (one by one, I need to process the data)?
Thanks in advance, n.b
Upvotes: 2
Views: 949
Reputation: 53125
You can build a SQL string using sys.columns or INFORMATION_SCHEMA queries. Here's a post I wrote on that.
Upvotes: 0
Reputation: 15849
Two choices.
1/ Use SSIS or ADO.Net to pour through your dataset row by row. 2/ Consider what you're actually needing to achieve and find a set-based approach.
My preference is for option 2. Let us know what you need done and we'll find a way.
Rob
Upvotes: 1