Msg 6602, Level 16, State 2, Procedure sp_xml_preparedocument, Line 1 The error description is 'The character '<' cannot be used in an attribute value.'.
Quando si usa la Stored procedure sp_xml_preparedocument si può verficare un errore durante l'inserimento dei dati, qualora si sta inserendo un valore di tipo xml. Per ovviare a tale problema, utilizzare i codici html per i simboli < (<) o > (>).
Qui di seguito si riporta un esempio di script
DECLARE
@xmlDocument nvarchar(max) SET @xmlDocument = N'<ROOT>
<TBL_xml Nome="EMa" data="11/12/2009" Codexml="<a>prova</a>" code="2" cognome="Ma">
</TBL_xml>
</ROOT>'
DECLARE
@punt INT
EXEC
sp_xml_preparedocument @punt OUTPUT, @xmlDocument
INSERT
TBL_xml
SELECT
* FROM OPENXML(@punt, N'/ROOT/TBL_xml')
WITH TBL_xmlSelect * from tbl_xml