Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let me start off by saying I know little and less about SQL. I received a .bak file from a client earlier today and they want me to move it to a new database (not SQL). I've created a SQL Server 2012 instance and restored the .bak file to a database and now it is .mdf file.

The last step of this process is getting it into either Excel or a .csv file (the inputs accepted by the new database system). I tried following the basic "right click and then select export and a destination" instructions, but I keep getting an error kicked back to me. I've copy/pasted the report below:

Operation stopped...

- Initializing Data Flow Task (Success)

- Initializing Connections (Success)

- Setting SQL Command (Success)

- Setting Source Connection (Success)

- Setting Destination Connection (Success)

- Validating (Success)

- Prepare for Execute (Stopped)

- Pre-execute (Stopped)

- Copying Rows (Error)
Error 0xc002f210: Preparation SQL Task 1: Executing the query "CREATE TABLE `aspnet_Profile` (
`UserId` GUID,
`..." failed with the following error: "The Microsoft Jet database engine could not find the object 'aspnet_Profile'.  Make sure the object exists and that you spell its name and the path name correctly.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
 (SQL Server Import and Export Wizard)

- Post-execute (Stopped)
share|improve this question

migrated from Dec 27 '13 at 13:21

This question came from our site for professional and enthusiast programmers.

I've seen this error once when I had the file open in Excel, thus locking it for writing. SSIS couldn't write to the file, and failed to create the table/sheet. – db2 Dec 27 '13 at 14:50
@db2: I have also noted this when the workbook itself is closed, but the instance of EXCEL which recently had it open is still running. It has occasionall been necessary to close both the workbook and the instance of EXCEL which recently had it open. – Pieter Geerkens Sep 21 '14 at 14:47

Seems like more often than not I run into issues trying to export to excel using the SSMS import/export wizard and I've never taken the time to learn and understand the quirks.

This doesn't necessarily answer your question, but might be a viable alternative. Instead of exporting to excel, consider importing into excel. This YouTube video appears to demonstrate it:

Of course, if you need to export a lot of tables or need to do this often this is a rather tedious approach, but it has worked very well for me with a lot fewer headaches when only exporting a few tables.

share|improve this answer
Also, I've often run into issues copying and pasting from an SSMS query window to excel when there are things like tabs and line breaks. I always follow the approach in that YouTube video to get around it, except in the last step where it asks how you'd like to view the data in your workbook, I click the properties button, change the command to SQL and copy in my query. – Eilert Hjelmeseth Feb 14 '15 at 4:10

Depending on how large your database is (in terms of number of columns and tables), I don't think you're going to like this particular answer. The failure is likely occurring because you would first need to create a skeleton XLS with all the corresponding columns and sheets predefined (ie; in an XLS file: create sheets that match all the table names and create all the columns predefined with the table column names), unless you create some kind of DTS to dynamically build it all for you - please DBA experts, correct me if I am wrong here.

If you do not wish to do all that, and it is a once off, you may want to consider performing a select statement for each table and then export the results of that select to an excel spreadsheet by using cut and paste in the SQL query window. Be aware that doing a full select * on a table is probably frowned upon by DBAs in a live production environment.

share|improve this answer
If you use the Import/Export wizard, it will typically create the sheets for you. – db2 Dec 27 '13 at 14:48
Interesting, when I tried with 2012, I got the same behavior as the OP. It wasn't until I prefabricated an XLS that it worked. – Damien Dec 28 '13 at 0:11
Now that's odd. I do exports all the time with 2012, and it's never made me set up the spreadsheet beforehand. – db2 Dec 30 '13 at 13:14
Interesting, I just tried again on a 2008 box, all behaved as expected, and the XLS was generated without any kind of existing destination file. Anyway, perhaps the original poster could use a BCP export per table instead: – Damien Jan 6 '14 at 1:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.