Loading ...
Sorry, an error occurred while loading the content.

4798XML Type in Management Studio

Expand Messages
  • Andy Mills
    Apr 4, 2012
    • 0 Attachment
      Hello All:

      I am having an issue. I am getting an error when trying to call a stored procedure from code.

      In order to debug the issue, I am trying to call the stored procedure from inside SQL Server Management Studio, doing the following:

      EXEC dbo.Attachments_SaveFileXml()

      And then passing in some variable information, but I am getting the following error:
      XML parsing: line 1, character 39, unable to switch the encoding

      The code looks as follows:
      DECLARE @xmlDoc xml,
      @AttachedTable varchar(50),
      @AttachedTableKeyValue int,
      @DivisionId int,
      @ModuleId int,
      @UserName varchar(50)

      SET @xmlDoc = '<?xml version="1.0" encoding="utf-16"?><ArrayOfAttachmentFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><AttachmentFile FileId="-1" DivisionId="1" CategoryId="-1" FileTypeId="4" ResolutionId="-1" Title="Image" FileName="39thPAMonument-03.jpg" FolderPath="/Uploads/Images/True Temper/NewItems/" Size="147706" DisplaySequence="0" IsThumbnailImage="false" IsActive="true" ModifiedBy="rcarbo" ModifiedOn="2012-04-04T00:00:00-04:00" CurrentUser="rcarbo" HasChanged="true" IsDeleted="false" /></ArrayOfAttachmentFile>'
      SET @AttachedTable = 'NewItemRelatedImages'
      SET @AttachedTableKeyValue = 1
      SET @DivisionId = 1
      SET @ModuleId = 18
      SET @UserName = 'rcarbo'

      EXEC dbo.Attachments_SaveFileXml

      The error is pointing to the definition of @xmlDoc. I tried to do a CAST( @xmlDoc AS XML) to another variable that is defined as XML, but get the same error on the CAST.

      How do I set this up so I can run the query to find out the issue?


      [Non-text portions of this message have been removed]
    • Show all 2 messages in this topic