Take the 2-minute tour ×
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.

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)
Messages
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
    
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
add comment

migrated from stackoverflow.com Dec 27 '13 at 13:21

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

1 Answer

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: technet.microsoft.com/en-us/library/aa337544.aspx –  Damien Jan 6 at 1:55
add comment

Your Answer

 
discard

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