| 
	
 | 
 Posted by Ed Murphy on 10/06/06 03:58 
£ukasz W. wrote: 
 
> I try to use a dynamic cursor as below. 
 
Cursors should be avoided if at all possible. 
 
>   print @id_position 
>   print @value 
>   print '----------------------------' 
 
Is this just a quick-and-dirty test?  If you're trying to generate an 
actual production file like this, then you should seriously consider 
having the database output raw data, and using some separate tool to 
apply formatting. 
 
>   update abc set value=666 --next reading should give value=666 
 
This is obviously dummy code.  What are you actually trying to do 
here - apply some function and use the result to control which row is 
output next?  What does that function look like?  It may be possible 
to rewrite the whole thing without cursors; failing that, you should 
seriously consider having the database output data unsorted, or sorted 
in a simple fashion, and using some separate tool (possibly the same 
one used to apply formatting) to apply the complex sort rule.
 
  
Navigation:
[Reply to this message] 
 |