Juan de Dios (2/16/2010)
This script is very useful when all the rows are not NULL, but if you modify the insert of Mark with NULL, the script only returns Bill.
insert into @table values (4, NULL,'M')
Where John goes???
Remember, in SQL, anything concat NULL = NULL,
therefore, when the NULL is encountered, the value is made NULL, then the next string is added. Since the definition is ISNULL(@var,''), the next value is added to the now empty string, delivering the last value
To cate for this, an aditional clause should be added to the predicate, viz:
AND Name IS NOT NULL
Space, the final frontier? not any more...
All limits henceforth are self-imposed.“libera tute vulgaris ex”