April 20th, 2009, 10:37 AM
Converting .mdf file to .csv
How can i convert a .mdf SQl server database primary data file into a .csv file?
I am relatively new to SQL server database stuff, would appreciate a reply with an example....
Thanks , cheers
April 20th, 2009, 08:14 PM
Originally Posted by ismailkhan2u
Why would you want to do that?
The MDF file is in a proprietary binary format.
If you have TABLES in your DATABASE that need to be exported to csv data, that's a different question entirely.
Use DTS or SSIS for that.
But in all honesty, you really, really, really need to read a book on SQL server first because it seems apparent that you lack fundamental understanding of database servers.
Don't take this as an insult - it's just an observation based on your post.
Try to understand first the basic architecture of a database server: all users connect to a process (simplistically speaking) known as the server.
All access to data is controlled by server processes.
The mdf and ldf files are maintained by the server and are generally speaking of no concern to you.
If you're used to working with flat-file based systems you will have to change your thinking radcally. The file is NOT the datbase. There IS no file for all intents and purposes. A SQL database uses a concept known as a table to store data.
These tables do not correspond to files as they do in flat-file or ISAM/VSAM types of systems.
These tables are the lowest level accessible to you for representing stored data.
The MDF file is just a "container" for a database that is used to store the data on disk: it can and usually does contain many tables.
If those tables need to be exported to a format like csv, there are wizards to help you do this from within enterprise manager (or management studio, depeding on SQL versioin)
Last edited by MadDogBrown; April 20th, 2009 at 08:22 PM.