Stored procedures:
ALTER proc [Ali].[ins_ frozen Amount Table]@xmldoc varchar(Max),@userGid varchar( -) asDeclare @idoc intexecsp_xml_preparedocument@idocOutput@xmldocInsert intoali.user frozen Amount TableSelect newid(),@userGid,*,getdate() fromOpenXML@idoc,'/alipay_user_account_freeze_get_response/freeze_items/account_freeze',2) with(Freeze_amountdecimal( -,2), Freeze_namevarchar( -), Freeze_typevarchar( -)) execSp_xml_removedocument@idoc--frees memory because the callsp_xml_preparedocument, it consumes one-eighth of the total memory of SQL Server, so use it to immediately eliminate
Because it is possible to return a "invalid character found in text content" error when executing sp_xml_preparedocument (because a Chinese character exists in XML), the header information needs to be added to the XML, and if the XML is varchar, the <?xml Version= "1.0" encoding= "gb2312"?>, or simply change the XML type to nvarchar, there will be no error.
Inserting XML data directly into SQL Server database