> I am sure this is really easy, but for some reason, I cannot 
> get a handle on this.  
> 
> Before I begin, I know this is simple and remedial in CF, but 
> I specifically want a SQL solution (if necessary, it can be a 
> Transact SQL solution)
> 
> Basically, I want to loop over a query using SQL syntax just 
> like you would loop over a query using <CFQUERY> or <CFLOOP 
> QUERY> tags. That is it. Looking for the same functionality 
> using SQL instead of CF.
> 
> I want to embed this functionality in a SQL script, but all 
> the solutions I have tried report that the request has 
> returned more than one possible match and errors out. Basically, 
> SQL is treating the select as a whole object verses looking 
> at each row one at a time. Any help you can provide would be
> great.

In SQL, you use cursors to loop over recordsets. The basic syntax is a bit
complicated for me to type in now, but basically you declare a cursor using
a SELECT statement, then fetch individual records into the cursor. It's very
well documented in your SQL Server Books Online.

However, very often, there's a better set-based solution available - cursors
are a procedural approach, and are often very inefficient within SQL.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

Reply via email to