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

  • SEARCH
  • Home
  • 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 7885339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:02:27+00:00 2026-06-03T05:02:27+00:00

i am going to be storing some text in a database. The text happens

  • 0

i am going to be storing some text in a database. The text happens to be xml.

i’m only storing and reading the “blob” of text (i am not using any of the xml querying or indexing facilities).

Is there any advantage to declaring the column as xml:

CREATE TABLE docs (pk INT PRIMARY KEY, xCol XML not null)

rather than nvarchar(max):

CREATE TABLE docs (pk INT PRIMARY KEY, xCol NVARCHAR(max) not null)    

i figure that if i give SQL Server the hint that the text is actually xml, then it can apply compression for more efficient storage.

Note: The third option is for me to compress the text client-side and store the data in a varbinary(max) blob column.

  • 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-03T05:02:28+00:00Added an answer on June 3, 2026 at 5:02 am

    Storing this as XML will most likely result in smaller storage size than nvarchar (I have found this to be true, at least due to removing irrelevant white space and other such formatting). However, SQL server will check that the XML is well-formed before each insert and update, so you can potentially suffer a performance penalty at those times. I would argue that this check is also an advantage like any data-type check.

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

Sidebar

Related Questions

I would like some advice. I'm going to be using an sqlite database that
I have some text that is being read in from the database. This text
I'm pulling some internationalized text from a MS SQL Server 2005 database. As per
I'm currently storing an array using its string representation in a MySQL TEXT column.
I've been storing some simple user click-actions in text files so I can easily
I hear that Data.Text is going to replace String s in future Haskell versions.
If the compiler is going to complain that a String object is not initialized
Going through some of my older Delphi projects and upgrading them to D2009, as
Going to http://www.example.com/node/NID/edit , where NID is any valid nid referring to a node
I've got some binary data that I store and was going to separate this

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.