How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask George Sibiya Your Own Question
George Sibiya
George Sibiya, Computer Hardware Engineer
Category: Programming
Satisfied Customers: 219
Experience:  PhD in Computer Science
94470076
Type Your Programming Question Here...
George Sibiya is online now
A new question is answered every 9 seconds

I need to convert my database from .mdf to .csv in order to

This answer was rated:

I need to convert my database from .mdf to .csv in order to change hhosting
JA: What programs and versions are you using?
Customer: but I don't know the first thing about SQL though I just downloaded SQL Express and SQL Server Management
JA: What is your ideal outcome? How can we solve this for you?
Customer: to have my data converted
JA: Anything else you want the programmer to know before I connect you?
Customer: I can't even open up to attach my databse

HI,

Welcome to JustAnswer and thank you for utilising our services.

Have you tried these steps:

1. Open the MDF file in SQL server

2. run and export a query from each table.

Regards,

G

Customer: replied 3 months ago.
I don't know how to open the .mdf file in SQL
Customer: replied 3 months ago.
I get an error message when trying to connect object explorer

Ok just a moment

Customer: replied 3 months ago.
TITLE: Connect to Server
------------------------------Cannot connect to JOHN-HP\SQLEXPRESS.------------------------------
ADDITIONAL INFORMATION:A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is ***** ***** that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1)For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=-1&LinkId=20476------------------------------
BUTTONS:OK
------------------------------

Which action brings up the error?

Customer: replied 3 months ago.
Connect to Server: Database Engine

Alright I am also experiencing a connection problem of my own. Just a moment while I try

Ok so my server was not running. Please if your is running by going to:

Control Panel >> Administrative Tools >> Services

Scroll and right-click on SQL Server and start it if it is not running

Customer: replied 3 months ago.
SQL Server Agent and SQL Server Browser are disabled. Why? What do I do?

Is "SQL Server (SQLEXPRESS)" in the list of services?

Customer: replied 3 months ago.
set to Automatic
Customer: replied 3 months ago.
hmmm it was Stopped
I started it
Customer: replied 3 months ago.
ok I'm in- now what?

I am in the same stage and tried to open a .mdf file. It openned but the tables were not there. You can go to File and open your .mdf file

I am still investigating a proper way or application that can open it

I am currently trying this: https://msdn.microsoft.com/en-us/library/ms239722.aspx

Customer: replied 3 months ago.
34;There is no editor available for [filename.mdf]
Make sure the application for the file type (.mdf) is installed

I got the same and now trying the above link which uses Visual Studio

https://msdn.microsoft.com/en-us/library/ms239722.aspx

On SQL Server Management Studio you can

Right-click on databases >> Attach >> Browse and select your .mdf file

In my case I have permissions denied still trying to work through it

Customer: replied 3 months ago.
access denied

Ok I'll let you know once I get past it. If we succesfully import the db we can even use the bcp command to export

http://www.cryer.co.uk/brian/sqlserver/howtoexportcsv.htm

Customer: replied 3 months ago.
Whatever you say! I'm wayyy out of my league

Alright go it now

You need to close the SQL Server Management Studio and run it as administrator i.e right-click on it and run as administrator

You will the be able to attach the mdf file without issues. After attaching it, on each table you can then:

Right-click in the table >> Script Table as >> SELECT To >> New Query Editor Window

The above will open a new window which retrieves everything from the table. No need to edit the query just run it and it will display all records from the table

The Righ-click on the results page just below the query >> Save Results as

The defaults will be a .csv format.

You just have to do it for each table I could not find a way to do all tables at once.

Please see attached and advice if you experience any difficulty

Customer: replied 3 months ago.
Sorry- stepped away. Let me read through this
Customer: replied 3 months ago.
TITLE: Microsoft SQL Server Management Studio
------------------------------An error occurred when attaching the database(s). Click the hyperlink in the Message column for details.------------------------------
BUTTONS:OK
------------------------------

Hmm... strange. Let me investigate possible reasons.

Customer: replied 3 months ago.
The Sever Agent is stopped. I tried to start it and it says "SQL Server Agent started and then stopped" Some services stop automatically if they are not in use by other programs"
Customer: replied 3 months ago.
does it need to be running?

The Agent and Browser are not important in our case

Please check this out: https://www.youtube.com/watch?v=tx2WhE3lQKE

Customer: replied 3 months ago.
OK. I need to leave for a couple of hours. What do I do with the ticket? Do I need to rate you now?

Yes once your issue is resolved you can provide the rating. Not urgent.

Customer: replied 3 months ago.
I have choices of files to attach- Master, Model, MSDBData, TempDB, and Zen Talent Data. I assumed my data was Zen Talent Data but that gave me the "error occurred when attaching the database". I have tried Master and it says it is being used by another program.
Customer: replied 3 months ago.
OK I have to leave now. How do I reconnect with you later tonight or tomorrow?

Ok no prob. Lets make it tomorrow. When you get back to it close all programs that might be using the file including the SQL Server Management Studio and start it as admin

Customer: replied 3 months ago.
OK I'm back. I rebooted the computer and started SQL Server Management as Admin. Getting the "An error occurred when attaching the database. Click the hyperlink in the message column for details." The hyper link gives me nothing of value.

Alright, if it is shareable you may share the .mdf file to export the tables for you and send back

This is however not a private channel between us I'd have to send a premium service offer for a secure exchange of your file

Its also possible to work remotely on your pc but since you have tried all the tricks above I am not sure why it refuses to work on it

Customer: replied 3 months ago.
I can send you the file. I looked you up on LinkedIn and you appear to be legit- i.e. not going to share the data anywhere. What do I need to do?

I am indeed. Thanks, ***** *****'ll send the offer shortly

George Sibiya and 4 other Programming Specialists are ready to help you

Hi John,

I am not of the actions it will allow you to perform, but this is the request and you can accept the answer if it allows you to.

Thank you so much

Regards,

G