I am coding application according design and many time there is need to rewrite commands like these:
foreach ( select @x = col ... from ... )
update, insert, exec...etc
endforeach
I d have some philosophical questions...
1) what do you use to rewrite this ? E.g. you automative, without thinking, write cursor according your template - it is fastest, easy and effective way how to re-write this
2) you use other way cos you concern about amount of written code and his simply fast re-reading in the future by other programmers ? E.g. cursor are heavy, lot of code etc. so we use simply temp table with indexed column and counter...
3) what concerns of effectivity and resource cost? You mostly use cursors/ temporary tables/db work tables cos ...... .
Conlusion first we use .... and if we see during testing problems we rewrite and use this ...
Thanks for your hints and points of view...