improvedk / OrcaMDF

A C# parser for MDF files. Allows you to read tables, metadata and indexes from MDF files without it being attached to a running SQL Server instance.
http://improve.dk/archive/2011/05/03/introducing-orcamdf.aspx
GNU General Public License v3.0
181 stars 74 forks source link

Unable to read new bit column #32

Closed dcs619 closed 7 years ago

dcs619 commented 8 years ago

I have a schema update coming to a database I'm tracking and I can't get OrcaMDF to read the new column (it always returns null). The new column is a nullable bit, exactly like an existing column.

TL;DR NoteTypeActive always reads correctly, NoteArchived will not.

Here's the schema for the table:

image

Here's a screenshot of some data:

image

Here's my code to read the field:

image

I'm using Boolean? to read the row value according to this document. I've also tried int?, bool?, and string without any success.

For context, I've used OrcaMDF to import millions of records and never had any issues. I'm at a loss to explain why the schema change would cause the data type to seemingly break. I'm running SQL Server 2012 on WS 2012.

dcs619 commented 7 years ago

I realize this code/issue is a few years old, but after I hit another issue (#29) I decided to dig around a bit. There's definitely an issue with OrcaMDF reading tables on the first page.

I was able to "fix" it by truncating/re-inserting data in the problem table (from SQL, not OrcaMDF). This resets the page pointer which OrcaMDF then reads correctly. I also took the opportunity to change the data type for certain fields from bit to varchar which will read all values consistently.

Thanks for being open source! Closing issue.