Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Data Corruption Issues
 Recover MDF. Question on bit fields

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-04-12 : 09:26:41
Marco writes "Hi,
I've a problem with a corrupted sql server 2005 database. The mdf file has a CRC error and I'm trying to recover the data.
I opened the MDF with a streamReader in Unicode mode and I'm recovering the data.
The problem is that I can't understand all bytes in each row because I don't know how sql server saves data.

The table is in this way:
ID (PK, bigint, not null)
Email (nvarchar(150), not null, UK)
Supplier (bit, not null)
Anonymous (bit, not null)
ContactUs (bit, not null)
Valid (bit, not null)
Date (smalldatetime, not null)
Blocked (bit, not null)
Code (nvarchar(10), not null)
BlockedDate (smalldatetime, null)
DomID (FK, int, null)
Reg (bit, null)

I have no problem to recover the nvarchar fields because it is very easy to view how they are saved, but I can't understand where the bit values are true or false.

May you tell me how is saved each row in the MDF files?
For example a row saved in unicode in this way:
?Sjbma@zjedu.orga186e2c4580궅 ⴃ䈀涗愀묀佃ఀ ˶䴀愀樀椀渀猀栀愀渀䀀搀礀樀椀渀猀栀愀渀⸀挀漀洀㔀昀㔀愀戀㐀㘀挀㤀攀 ᤀ蘀Ⴍ ̀-靂ns읃
what does it means? Probably the first 4 unicode chars is the bigint, the other are surely email and code, but after that I can't understand any more.
May you help me with some suggestions?
Thanks very much."

nr
SQLTeam MVY

12543 Posts

Posted - 2006-04-12 : 11:28:26
Have a look at
http://www.nigelrivett.net/SQLAdmin/PageStructure.html

It shows how things were stored for v2000 - don't know if v2005 is similar.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-04-12 : 11:49:26
"I opened the MDF with a streamReader in Unicode mode and I'm recovering the data"

Blimey, that sounds like hard work - or is it actually more straightforward than I'm imagining?

Kristen
Go to Top of Page
   

- Advertisement -