Unix Technical Forum

XML, schema collection and "large value types out of row" problem

This is a discussion on XML, schema collection and "large value types out of row" problem within the SQL Server forums, part of the Microsoft SQL Server category; --> Hello, I have a problem with XML schema update for one XML column (problem exists in both SP1 and ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-01-2008, 02:43 PM
eduardasm
 
Posts: n/a
Default XML, schema collection and "large value types out of row" problem

Hello,

I have a problem with XML schema update for one XML column (problem
exists in both SP1 and SP2 for SQL Server 2005).

1. I have a table that looks like this:
CREATE TABLE [dbo].[tProduct](
[ProductId] [uniqueidentifier] NOT NULL DEFAULT (newid()),
[Caption] [nvarchar](500) NOT NULL,
[XMLName] [xml] NULL,
[XMLBlob] [xml](CONTENT [dbo].[ProductInputXml]) NULL,
[SyncDate] [timestamp] NULL,
CONSTRAINT [PK_tProduct] PRIMARY KEY CLUSTERED
(
[ProductId] ASC
))

2. I have to update the xml schema for XMLBlob. The datalength inside
XMLBlob is bigger than 8060, that is why it is stored as follows::
EXEC sp_tableoption N'dbo.tProduct', 'large value types out of row',
1;

3. I create a backup table, move XML to the backup table, alter the
column data type to regular xml, drop schema and create a new one.
Then I bind the column to the xml schema collection. (Here I do not
care about XMLName column)

CREATE TABLE dbo.tProductBackup(
[ProductId] [uniqueidentifier] NOT NULL,
[XMLBlob] [xml] NULL
)
GO

EXEC sp_tableoption N'dbo.tProductBackup', 'large value types out of
row', 1;
GO

INSERT INTO dbo.tProductBackup(ProductId, XMLBlob)
SELECT ProductId, XMLBlob
FROM dbo.tProduct;
GO

UPDATE dbo.tProduct
SET XMLBlob = NULL, XMLName = NULL;
GO

ALTER TABLE dbo.tProduct
ALTER COLUMN XMLBlob XML
GO

IF EXISTS (SELECT * FROM sys.xml_schema_collections c, sys.schemas s
WHERE c.schema_id = s.schema_id AND (quotename(s.name) + '.' +
quotename(c.name)) = N'[dbo].[ProductInputXml]')
DROP XML SCHEMA COLLECTION [dbo].[ProductInputXml]
GO

CREATE XML SCHEMA COLLECTION [dbo].[ProductInputXml]
AS '.... xsd ....'
GO

ALTER TABLE dbo.tProduct
ALTER COLUMN XMLBlob XML(dbo.ProductInputXml)
GO

EXEC sp_tableoption N'dbo.tProduct', 'large value types out of row',
1;
GO

4. When I try to update the original table I get the error message:

UPDATE dbo.tProduct
SET XMLBlob = b.XMLBlob
FROM dbo.tProduct, dbo.tProductBackup b
WHERE dbo.tProduct.ProductId = b.ProductId
GO

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

Can anybody see what is wrong here?

/Ed

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:13 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com