Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7824691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:41:14+00:00 2026-06-02T08:41:14+00:00

I am capturing data from the inserted and deleted tables as xml and saving

  • 0

I am capturing data from the inserted and deleted tables as xml and saving it to an audit log but for some reason empty elements are begin generated for null values. This appears to contradict the documentation which says:

The ELEMENTS directive constructs XML in which each column value maps
to an element in the XML. If the column value is NULL, no element is
added
. By specifying the optional XSINIL parameter on the ELEMENTS
directive, you can request that an element also be created for the
NULL value. In this case, an element that has the xsi:nil attribute
set to TRUE is returned for each NULL column value.

I’m quite certain I’m not using the XSINIL parameter but the elements are being created all the same. I’ve tried playing with the generation mode; trying RAW, AUTO, etc but the empty tags remain regardless.

Its a dynamically generated query that looks like:

'SET @LogData =
        CASE
            WHEN @EventType = @Insert
            THEN
            (
                SELECT ' + @ColumnList + '
                FROM Inserted
                FOR XML RAW, ELEMENTS
            )
            WHEN @EventType = @Delete
            THEN
            (
                SELECT ' + @ColumnList + '
                FROM Deleted Rows
                FOR XML RAW, ELEMENTS
            )                           
        END;'

Where @LogData is of type xml and @ColumnList is in the format:

[Column1Name],
[Column2Name]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T08:41:16+00:00Added an answer on June 2, 2026 at 8:41 am

    Turns out the table I was testing had nearly every column (400+) set to a default constraint of an empty string, which resulted in those columns being included in the generated xml.

    Other tables I tested did not have this default constraint so xml was generated as expected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm capturing data from the user and writing it to an xml string like
I have a form that is capturing data sent from a google LocalSearch API.
Im currently wishing to transfer data from a remote server by capturing printed data
I am trying to fit a distribution to some data I've collected from microscopy
AMcap is a app for capturing video or to preview from webcam. Its source
I'm looking for a solution for capturing audio from a user's microphone and posting
I would like to scrape some dynamic data off of a website. On the
I capture data with tshark and save certain data from the packet header to
I'm trying to create an MVC view that will display some data in a
I'm creating a data capturing page with drop down lists that are dynamically filled

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.