Set-based execution; SQL and .NET -
in sql, 1 should strive set-based operations versus iteration-based (i.e. looping). in .net, loop collections , objects. there commands in .net allow set-based processing or iteration-based? (i'm reminded of how dataadapter.fill
calls datareader
iterates through each record in result set). i'm not terribly familiar linq
, guess implementation merely masks iterations happening behind scenes.
update:
to clarify: i'm not claiming sort of genius here , i'm not second guessing of brilliant people make life programming better. asking if there commands perform set-based operations, sql when update
, versus foreach(var item in obj) { ... }
iterating through object. sql developers chastised @ every turn if ever use loop, yet in .net, use them time. being develper works heavily in both sql , .net, i'm asking if there alternatives in .net avoid looping altogether.
i'm not terribly familiar linq, guess implementation merely masks iterations happening behind scenes.
how think sql it? it's not iteration doesn't happen. it's matter of how express intentions in code. set-based , declarative operations tell platform want, , leave platform figure out how best it. works because platforms allow kind of code expert systems in area, , better @ human hope be. on other hand, imperative or procedural code tells platform , how it. leaves less room machine optimizations, requires more code, , more prone bugs.
Comments
Post a Comment