|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Tuesday, March 05, 2013 5:58 AM
Points: 199,
Visits: 741
|
|
Hi Team
Last week we run dbcc command on few databases and found the below consistency errors in the database ,no allocation errors .
Please see below error and provide u r inputs .
The error due to decimal data type for column 'amount1' , i checked the table and the column is like
amount1 (decimal(13,4),null) ...
************************ DBCC results for 'table1'. Msg 2570, Level 16, State 3, Line 1 Page (12:3592881), slot 119 in object ID 6447247, index ID 1, partition ID 72057598160928768, alloc unit ID 72057598189436928 (type "In-row data"). Column "Amount1" value is out of range for data type "decimal". Update column to a legal value.
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 6:33 AM
Points: 22,
Visits: 240
|
|
Basically you have to identify the rows that contain the invalid value and update them with a valid value. Have a look at:
Troubleshooting DBCC error 2570 in SQL Server 2005 and later versions http://support.microsoft.com/kb/923247
Look for: Finding Rows with Invalid Values Using T-SQL Queries Decimal and Numeric data type: -- SELECT col1 FROM table2 WHERE col2 > 9999999999.99999 OR col1 < -9999999999.99999 -- Keep in mind that you will need to adjust the values based on the precision and scale with which you have defined the decimal or numeric column. In the above example, the column was defined as col2 decimal(15,5).
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Tuesday, March 05, 2013 5:58 AM
Points: 199,
Visits: 741
|
|
| what is col1 in this script??
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 6:33 AM
Points: 22,
Visits: 240
|
|
Primary key maybe. Something that helps you identify the row.
You could also narrow down the problem if above isn't working for you. Select column from xx where column between 1 and 100.
if it doesnt fail continue to between 100 and 1000 until you narrow it down. In the end you will find the row causing the problem and then run an update statment on that row that fixes the out of range value.
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 3:10 AM
Points: 37,642,
Visits: 29,896
|
|
Take a look at this article. http://www.sqlservercentral.com/articles/65804/, there's a section on data purity errors and a like to a kb article that goes into detail on fixing them
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP 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
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 6:33 AM
Points: 22,
Visits: 240
|
|
| Same link to the kb that I posted above.
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Yesterday @ 9:27 PM
Points: 6,695,
Visits: 11,711
|
|
Let's make that link an actual link:
http://support.microsoft.com/kb/923247
The article Gail linked to above has a more "to the point" explanation of why these values can exist in your database, just search for the section named "Data Purity errors."
__________________________________________________________________________________________________ There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Believe you can and you're halfway there. --Theodore Roosevelt
Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein
The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein
1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Tuesday, March 05, 2013 5:58 AM
Points: 199,
Visits: 741
|
|
Thanks to all.
I go through the link , now my issue with the decimal data type
SELECT col1 FROM table2 WHERE col2 > 9999999999.99999 OR col1 < -9999999999.99999
In this script col1 is primary key and col2 is the column from eroor.
The same thing i checked for my issue,some tables doesn't have any column with primary key, and some tables have clumn primary key but its datatype is int not decimal .
suggest me how to get data_purity values using the above script ..
Col1 and col2 should be same data type (decimal)??
Lavanyasri
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 3:45 AM
Points: 572,
Visits: 1,157
|
|
Lavanyasri (2/21/2013) Thanks to all.
I go through the link , now my issue with the decimal data type
SELECT col1 FROM table2 WHERE col2 > 9999999999.99999 OR col1 < -9999999999.99999
In this script col1 is primary key and col2 is the column from eroor.
The same thing i checked for my issue,some tables doesn't have any column with primary key, and some tables have clumn primary key but its datatype is int not decimal .
suggest me how to get data_purity values using the above script ..
Col1 and col2 should be same data type (decimal)??
Lavanyasri
The above code looks like a typo error what you need to check is
SELECT col1 FROM table2 WHERE col2 > 9999999999.99999 OR col2 < -9999999999.99999
Here Col1 is the primary key and col2 is the decimel you need to check.
Col1(PK) doesnt need to be of the same datatype. You need this column to uniquely idenntify the corrupt rows, decide on what to do with them
-- Roshan Joe ******************************************* Jeff Moden -Forum Etiquette: How to post data/code on a forum to get the best help Custom cleanup script for backups
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Tuesday, March 05, 2013 5:58 AM
Points: 199,
Visits: 741
|
|
some tables doesn't have any column with primary key.... if i run that script on production, it will cause any performance issues ??
|
|
|
|