469,903 Members | 1,909 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,903 developers. It's quick & easy.

Edit .mdf database

Greetings,

Are there any tools freely available to modify or edit a .mdf database
file? As far as seeing the actual tables?

Regards,
cd

Jul 23 '05 #1
6 24981
MSDE:
http://www.microsoft.com/sql/msde/
http://www.aspfaq.com/show.asp?id=2442

--
David Portas
SQL Server MVP
--

Jul 23 '05 #2
No, and I'm not sure why you'd want to do this - even if you managed to
change data pages in a .mdf file directly, you would corrupt the
metadata (indexes, allocation maps, statistics etc.), and the
transaction log would also need to be updated. As far as I know, MSSQL
itself is the only tool that can read and modify .mdf files (at least
outside Microsoft).

I'm not sure what your real goal is, but if you need to retrieve data
from an .mdf file, then you can try attaching it to an MSSQL
installation with sp_attach_single_file_db. If you don't have an MSSQL
installation, you can download MSDE for free, although it's limited to
2GB databases.

If this isn't helpful, I suggest you give some more details of what
you're trying to do.

Simon

Jul 23 '05 #3
I pretty much want to be able to look at a .mdf file to see what could
be mangled in it. If for some reason the application that writes to
the database gives an error because of invalid character or something
in a certain field i would like to see what field it is and what's in
it. Simply attaching it does me no good.

Jul 23 '05 #4
If you are developing an application then you could attach the DB to
Developer Edition (cost $50) to test for this sort of problem with the
benefit of Query Analyzer, Profiler and the other tools.

Is this scenario something you have actually experienced? What makes
you think that you could have a problem caused by an "invalid
character"?

If you think a database is corrupt then the DBCC command can be used to
validate a table or database and fix these problems.

--
David Portas
SQL Server MVP
--

Jul 23 '05 #5
I don't really understand what sort of errors you're talking about. If
you can't insert data into a table, then MSSQL will return an error
message, which you need to handle in your client:

http://www.sommarskog.se/error-handling-I.html

Perhaps if you can give a more specific example of the sort of error
you're getting, someone can suggest a solution. It would also be good
to know which version of MSSQL you have, what client application or
library you're using, what query you're executing etc.

http://www.aspfaq.com/etiquette.asp?id=5006

Simon

Jul 23 '05 #6
(mi*******@gmail.com) writes:
I pretty much want to be able to look at a .mdf file to see what could
be mangled in it.
If your database is corrupt so that you cannot easily repair it with
DBCC, you should open a case with Microsoft. Editing the internal
structures of database file will just mangle it even more.
If for some reason the application that writes to the database gives an
error because of invalid character or something in a certain field i
would like to see what field it is and what's in it. Simply attaching it
does me no good.


Your application cannot on its own corrupt the database. It would
need help from either a bug in SQL Server or bad hardware.

If your application produces an error message, you should first use the
Profiler to find where what statements the application is sending. Once
there you can run the queries in Query Analyzer. In QA you can run commands
like sp_help to see the definition of tables and constraints etc.

My guess is that you run a third-party app. In such, you should open a
support case with that vendor.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Ruby Tuesday | last post: by
25 posts views Thread by dixie | last post: by
4 posts views Thread by visionstate | last post: by
rcollins
2 posts views Thread by rcollins | last post: by
1 post views Thread by Markw | last post: by
4 posts views Thread by ghjk | last post: by
reply views Thread by ghjk | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.