How do I copy all tables in database to Excel - sql-server

I have a SQL Server 2008 database and I wanted to quickly copy all the data in the database into either separate Excel spreadsheets or into a single spreadsheet in separate tabs. Putting the data into separate CSV files is also ok. How do I do this without having to do a select * from for each of the tables and then copying the data into Excel? There are a lot of tables.
EDIT
Running the wizard to export data I get this error on Pre-execute
Pre-execute (Error)
Messages
Error 0xc0202009: Data Flow Task 1: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E21.
(SQL Server Import and Export Wizard)
Error 0xc0202025: Data Flow Task 1: Cannot create an OLE DB accessor. Verify that the column metadata is valid.
(SQL Server Import and Export Wizard)
Error 0xc004701a: Data Flow Task 1: component "Destination - ApprovalStatuses" (25) failed the pre-execute phase and returned error code 0xC0202025.
(SQL Server Import and Export Wizard)
Thanks,
Sachin

Using Server Management Studio:
Server Management Studio (right click on db) >
Tasks >
Export >
Login >
Destination box select Microsoft Excel > ...
If you are on a 64-bit server then;
Windows > Start Button >
All Programs >
MS Sql Server [your version] >
USE Import and Export Data (32-bit)

See this link http://www.66pacific.com/sql_server_export_to_excel.aspx
Using the SQL Server Import and Export Wizard, you can easily copy tables from the database to the spreadsheet.

You can directrly export table from database to excel file using sql-server Import and Export Wizard.
Have look at this article about Exporting SQL Server Data to Excel.

Ok, see this link http://www.hotscripts.com/forums/windows-net-programming/59962-export-data-database-excel-via-sql-command-customize-style-vb-net-without-auto.html for a quick way of doing it.
Ideally, if you get time to program it, I would use RDLC to build custom reports which you can export out as Excel using DataTables.
See my blog post at https://mashupweb.wordpress.com/2012/02/08/creating-an-online-list-of-users-in-a-database-using-report-wizard/ on how export data onto Excel using RDLC.

Related

SSMS can't open data file

Im trying to import a .csv file in SQL Server Management Studio using the import export wizard.
I just created a database and when I used the wizard I ran into several errors. This is the error log.
Pre-execute (Error)
Messages
Information 0x402090dc: Data Flow Task 1: The processing of file "G:\SLIIT\3 YEAR\2 SEM\DWBI\assignment\datasource\steam_description_data.csv" has started.
(SQL Server Import and Export Wizard)
Information 0x402090dc: Data Flow Task 1: The processing of file "G:\SLIIT\3 YEAR\2 SEM\DWBI\assignment\datasource\steam_description_data.csv" has started.
(SQL Server Import and Export Wizard)
Warning 0x80070020: Data Flow Task 1: The process cannot access the file because it is being used by another process.
(SQL Server Import and Export Wizard)
Error 0xc020200e: Data Flow Task 1: Cannot open the datafile "G:\SLIIT\3 YEAR\2 SEM\DWBI\assignment\datasource\steam_description_data.csv".
(SQL Server Import and Export Wizard)
Error 0xc004701a: Data Flow Task 1: Source - steam_description_data_csv failed the pre-execute phase and returned error code 0xC020200E.
(SQL Server Import and Export Wizard)
I don't have the file open with any other programs so i'm unsure why it even said it was being used by another program.
any way to fix this?

SQL Server import and export wizard - change concurrent setting

I am trying to export several (~40) tables using the SQL Server import and export wizard (Right click database -> Task -> Export Wizard).
The wizard allows me to export all tables from database, 1 by 1, without error.
However, when I want to export all tables together, there is an error. I guess it is due to a concurrency issue (because the screen shows 2 tables are exporting together).
Can I change concurrency settings of the wizard? (set maxconcurrentexecutables to 1 in SQL Server). Or, do I need to use SSIS?
The error message is below:
Pre-execute (Error) Messages Error 0xc0202009: Data Flow Task 2: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error
code: 0x80040E37. (SQL Server Import and Export Wizard)
Error 0xc02020e8: Data Flow Task 2: Opening a rowset for "Table16" failed. Check that the object exists in the database. (SQL Server
Import and Export Wizard)
Error 0xc004701a: Data Flow Task 2: Destination 7 - Table16 failed the pre-execute phase and returned error code 0xC02020E8. (SQL Server
Import and Export Wizard)

SQL Server Import OLE DB error 0x80040E09

I just installed SQL Server 2014 and now I'm trying to import an Access database. To do the import I use the SQL Server 2014 Import and Export Data Wizard. I can go trough all steps of the wizard except the step below, which gives me this error.
The red underlined text is Dutch the translation for this line is: Cannot read the records. U don't have permission for tblAanmaningHistorie to read the data.
tblAanmaningHistorie is the first table in the Access database, when I try to import other tables I get the same error.
Data source screen
How to fix this?

Failed importing file in SQL Server Managment studio

In SQL Server Management Studio I exported a table from one database to an .xslx file, then imported it to another database on a different server. It failed to import and gave the following details:
Validating (Error)
Messages
• Error 0xc0202049: Data Flow Task 1: Failure inserting into the read-only column "QuestionID".
(SQL Server Import and Export Wizard)
• Error 0xc0202045: Data Flow Task 1: Column metadata validation failed.
(SQL Server Import and Export Wizard)
• Error 0xc004706b: Data Flow Task 1: "component "Destination - HJFast_Track" (47)" failed validation and returned validation status "VS_ISBROKEN".
(SQL Server Import and Export Wizard)
• Error 0xc004700c: Data Flow Task 1: One or more component failed validation.
(SQL Server Import and Export Wizard)
Error 0xc0024107: Data Flow Task 1: There were errors during task validation.
(SQL Server Import and Export Wizard)
My best guess is that QuestionID is an auto-incrementing identity field. In order to insert values into that column you'll need to specify.
SET IDENTITY_INSERT YourTable ON
Your other option if that field is an auto-increment identity is leave it out of the import/export and let the sql engine generate keys like it would for any other insert.
Without having the schema of your table in front of me a guess is as good as I can offer.
If you update your question with the structure of the table your trying to insert that might give other clues. For example, if QuestionID is a guid or something.

Import flat file into SQL Server 2005 with Import/Export wizard gives product level error

I am using SQL Server Management Studio Enterprise 2005.
I am trying to import a text file with pipe delimited data into my SQLserver table.
However when the process of importing, the system gave me this error log:
Operation stopped...
Initializing Data Flow Task (Success)
Initializing Connections (Success)
Setting SQL Command (Success)
Setting Source Connection (Success)
Setting Destination Connection (Success)
Validating (Error)
Messages
Error 0xc00470fe: Data Flow Task: The product level is insufficient for component "Source - userrolelist_TXT" (1).
(SQL Server Import and Export Wizard)
Error 0xc00470fe: Data Flow Task: The product level is insufficient for component "Data Conversion 1" (95).
(SQL Server Import and Export Wizard)
Prepare for Execute (Stopped)
Pre-execute (Stopped)
Executing (Success)
Copying to [SOD].[dbo].[userrolelist] (Stopped)
Post-execute (Stopped)
Cleanup (Stopped)
I have read that I would need to install SP2 because this is a bug. Anyone know how can I solve this and are there any other alternative I can use to import a pipe delimited data file into my tables?
Services required for SSIS on your SQL Server installation might not have been installed such as ervice, dtexec, and dtexecui.
http://social.msdn.microsoft.com/forums/en-US/sqlintegrationservices/thread/289d0bbb-1d06-4856-9c66-8d3e540d7be9/
are there any other alternative I can use to import a pipe delimited
data file into my tables?
I believe Kip has hit the nail on the head with the Integration Services Service not being installed.
If this is a straight import of data, it's hard to beat bcp or BULK INSERT.

Resources