Devi sostituire SET con SELECT e funzionerà quindi questo SET @xml = ( deve essere sostituito con SELECT @xml = (