You could create a user defined function that accepts an xml parameter, and use something like this:
Code:declare @data xml; set @data = ' <Data> <Needs> <CurrentIncome>500000</CurrentIncome> </Needs> <Needs> <CurrentIncome>750000</CurrentIncome> </Needs> </Data>' SELECT sum(INCOME.value('.','money')) From @Data.nodes('//Needs/CurrentIncome') as Data(INCOME)




Reply With Quote