Carlo Romagnano (11/27/2009)
Rob Goddard (11/27/2009)
does the optimizer spot this and skip all the variable assignments and just do the last one?All the variable assignments are done.
I spose this makes sense given the quick method of building a csv from a column i.e. it's clearly possibly that a single variable declaration from a select which returns multiple rows can make use of information from every row.
For the optimiser to spot that it was being assigned to a single variable AND that it would only require data from one row to create the necessary value, it would have to be an exceedingly clever piece of logic.
-- Kev
-------------------------------Oh no!