SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Column "pobs_name" value is out of range for data type "varchar". Update column to a legal value


Column "pobs_name" value is out of range for data type "varchar". Update column to a legal value

Author
Message
msandico 57892
msandico 57892
SSC Veteran
SSC Veteran (231 reputation)SSC Veteran (231 reputation)SSC Veteran (231 reputation)SSC Veteran (231 reputation)SSC Veteran (231 reputation)SSC Veteran (231 reputation)SSC Veteran (231 reputation)SSC Veteran (231 reputation)

Group: General Forum Members
Points: 231 Visits: 195
Hi All,

I recently found (from our weekend maintenance) that one of our vendor databases encountered a corruption notice and am trying to figure out (without going straight to allow_repair_data_loss) what rows have the 'bad' data and what is the actual cause of this error:

I ran this command: dbcc checkdb ('pmdb_cn') WITH DATA_PURITY

Results:


DBCC results for 'POBS'.
Msg 2570, Level 16, State 3, Line 1
Page (1:110113), slot 10 in object ID 2121058592, index ID 1, partition ID 72057594055688192, alloc unit ID 72057594065453056 (type "In-row data"). Column "pobs_name" value is out of range for data type "varchar". Update column to a legal value.
Msg 2570, Level 16, State 3, Line 1
Page (1:110113), slot 14 in object ID 2121058592, index ID 1, partition ID 72057594055688192, alloc unit ID 72057594065453056 (type "In-row data"). Column "pobs_name" value is out of range for data type "varchar". Update column to a legal value.
Msg 2570, Level 16, State 3, Line 1
Page (1:110117), slot 38 in object ID 2121058592, index ID 1, partition ID 72057594055688192, alloc unit ID 72057594065453056 (type "In-row data"). Column "pobs_name" value is out of range for data type "varchar". Update column to a legal value.
Msg 2570, Level 16, State 3, Line 1
Page (1:110117), slot 42 in object ID 2121058592, index ID 1, partition ID 72057594055688192, alloc unit ID 72057594065453056 (type "In-row data"). Column "pobs_name" value is out of range for data type "varchar". Update column to a legal value.
There are 299 rows in 7 pages for object "POBS".
CHECKDB found 0 allocation errors and 4 consistency errors in table 'POBS' (object ID 2121058592).
DBCC results for 'HQDATA'.
There are 0 rows in 0 pages for object "HQDATA".
DBCC results for 'TPROJMAP'.
There are 0 rows in 8 pages for object "TPROJMAP".
DBCC results for 'WRK_LOG_RESULTS'.
There are 0 rows in 0 pages for object "WRK_LOG_RESULTS".
CHECKDB found 0 allocation errors and 4 consistency errors in database 'PMDB_CN'.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.



The table structure is this:


CREATE TABLE [dbo].[POBS](
[pobs_id] [int] NOT NULL,
[seq_num] [int] NOT NULL,
[pobs_name] [varchar](255) NOT NULL,
[pobs_parent_id] [int] NULL,
[pobs_descr] [varchar](255) NULL,
[pobs_manager] [varchar](255) NULL,
[update_date] [datetime] NULL,
[update_user] [varchar](255) NULL,
[create_date] [datetime] NULL,
[create_user] [varchar](255) NULL,
[delete_session_id] [int] NULL,
[delete_date] [datetime] NULL,
CONSTRAINT [pk_pobs] PRIMARY KEY CLUSTERED
(
[pobs_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]



I'm running on SQL Server 2008 R2 + SP3

When I do a count of the records in Management Studio, I get 303.
DBCC CHECKDB output says 299 rows.

So am I really missing 4 rows? Or is it indicating that there are 4 rows that have invalid data in the particular column? -- which wouldn't make sense as I would've figured the datatype definition wouldn't have allowed the data to be inserted in the first place.

Thanks in advance
msandico 57892
msandico 57892
SSC Veteran
SSC Veteran (231 reputation)SSC Veteran (231 reputation)SSC Veteran (231 reputation)SSC Veteran (231 reputation)SSC Veteran (231 reputation)SSC Veteran (231 reputation)SSC Veteran (231 reputation)SSC Veteran (231 reputation)

Group: General Forum Members
Points: 231 Visits: 195
Digging around some more, wanted to share what I found:

Using this link - http://support.microsoft.com/kb/923247

I did a DBCC PAGE on the affected pages and went to the specific slot that reported an issue. Then I was able to find the pobs_id of that row and could do a SELECT against the table and see the 'bad data':



DBCC PAGE ( pmdb_cn , 1 , 110117 , 3 )

Slot 38 Column 3 Offset 0x3c Length 255 Length (physical) 255
pobs_name = INVALID COLUMN VALUE

select * from POBS where pobs_id=6932
???????????????????????????????聽???????????????虏???????????????楼???????????????拢???????????????庐???????????????掳????????????????




So it looks like i have 4 rows where the data is unicode (Chinese characters) and cannot fit into this column.

I'm thinking that the datatype of the column should be NVARCHAR not VARCHAR in order to accept these values and be compatible with unicode characters. The db collation is Chinese so i *think* this column should be set to nvarchar..thoughts?
GilaMonster
GilaMonster
SSC Guru
SSC Guru (234K reputation)SSC Guru (234K reputation)SSC Guru (234K reputation)SSC Guru (234K reputation)SSC Guru (234K reputation)SSC Guru (234K reputation)SSC Guru (234K reputation)SSC Guru (234K reputation)

Group: General Forum Members
Points: 234966 Visits: 46376
You need to update the column to legal values, consider altering the column later. But there's no guarantee that that is even a legal unicode string. Somehow invalid values have crept in, who knows what that was or is supposed to be.

btw, repair can't fix data purity errors. You need to manually update the affected rows to valid values.

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


msandico 57892
msandico 57892
SSC Veteran
SSC Veteran (231 reputation)SSC Veteran (231 reputation)SSC Veteran (231 reputation)SSC Veteran (231 reputation)SSC Veteran (231 reputation)SSC Veteran (231 reputation)SSC Veteran (231 reputation)SSC Veteran (231 reputation)

Group: General Forum Members
Points: 231 Visits: 195
GilaMonster (7/15/2014)
You need to update the column to legal values, consider altering the column later. But there's no guarantee that that is even a legal unicode string. Somehow invalid values have crept in, who knows what that was or is supposed to be.

btw, repair can't fix data purity errors. You need to manually update the affected rows to valid values.


Right, I think the presence of question marks in the data indicate invalid values (hence SQL turning them into question marks), correct? Or values where the original data was a Unicode character that cannot be imported/non-compatible with the database collation..?

I will go back to the application admin to ask for valid values to be entered.
GilaMonster
GilaMonster
SSC Guru
SSC Guru (234K reputation)SSC Guru (234K reputation)SSC Guru (234K reputation)SSC Guru (234K reputation)SSC Guru (234K reputation)SSC Guru (234K reputation)SSC Guru (234K reputation)SSC Guru (234K reputation)

Group: General Forum Members
Points: 234966 Visits: 46376
It's invalid values (not varchar data) that due to some bug somewhere has snuck into the table. That's about all you can say.

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search