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 8634081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:37:56+00:00 2026-06-12T09:37:56+00:00

In our database, there is a table with a column of XML datatype. The

  • 0

In our database, there is a table with a column of XML datatype. The column was mandatory (not null), I needed to make it non-mandatory (null). I wrote a script similar to:

alter table [SomeSchema].[SomeTable] alter column [SomeColumn] XML null

I needed to write/test a rollback script, so I wrote one similar to:

alter table [SomeSchema].[SomeTable] alter column [SomeColumn] XML not null

The initial statement executed correctly. When I attempted to test/execute the rollback, I got the following error:

Msg 511, Level 16, State 1, Line 1
Cannot create a row of size 8082
which is greater than the allowable maximum row size of 8060. The
statement has been terminated.

The issue seems to relate to row overflow, which supposedly shouldn’t apply to XML types (but seems to in this circumstance). This issue only occurs when certain records are in the table (i.e. it’s affected by data), but it doesn’t seem to directly correlate to the size of the data. For example, one record had an XML length of 10,473 characters and triggered this issue; another record had an XML length of 159,072 characters and didn’t trigger the issue.

Setup:

  • Windows XP SP3
  • SQL Server 2008 R2
  • 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-12T09:37:58+00:00Added an answer on June 12, 2026 at 9:37 am

    Our resident DB guru managed to find some code to fix the issue (see below), but still can’t explain why this is occurring/necessary. Our suspicion is that XML smaller than 8060 bytes will be stored in-row, while larger XML will be stored in LOB storage, and that somehow applying the [non-]mandatory constraint is causing the row-size to be increased beyond this limit, but SQL Server isn’t dealing with this gracefully. We’re still at a loss as to:

    • what is actually going on
    • why we’re getting this error (SQL Server bug? bad practice on our part?)
    • why this is occurring for some records already larger than 8k

    Any explanations welcome!

    exec sp_tableoption '[SomeSchema].[SomeTable]', 'large value types out of row', 1;
    go
    
    alter table [SomeSchema].[SomeTable] drop constraint [ThePKConstraint]
    go
    
    alter table [SomeSchema].[SomeTable] add constraint [ThePKConstraint] primary key clustered
    (
          [SomeIDColumn] asc,
          [SomeOtherIDColumn] asc
    )
    go
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In our database there is a table which is created with ANSI_NULLS OFF .
I have a database which has a table with an XML column. The XML
Our SSDT database project includes a table that has a computed column that can
We need to perform the following operation in our database : There is a
There are two variables in our database called OB and B2B_OB . There are
There is a constant change (!) in our database, new columns are often added.
Suppose a column client_id is ubiquitous through out our database, and for a given
Programs used: SQL Server 2000, Excel 2003 We have a table in our database
I have two columns (among others) in a database table: ExitDate and ExitReason. Our
I'm having to insert values into a new column in our database but I

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.