sql server 2008: importing data from excel 2003 file - sql

i have a very simple excel file that i need to import into a table in sql server 2008.
one of the fields is a bit complex and i dont think it can be saved effectively to a csv, since it sometimes has comas and single quotes in it. it screwed up the formatting when i save to a csv. so i would like to try to import directly from the xls file.
does anyone know how to import from xls to sql server ?

For Express, run C:\Program Files\Microsoft SQL Server\100\DTS\Binn\DTSWizard.exe

try using the sql server management studio
right click in your database -> Tasks -> Import Data..
check this link for more info
How to: Run the SQL Server Import and Export Wizard

SQL Server has an import wizard that works with .xls files.

The import wizard generates an SSIS package for you. If you want more control, you can create the SSIS package yourself in Visual Studio.

SQL Server Integration Services for the win. Check this out!

Related

Export database from SQL Server Management Studio

I've managed to 'Restore' my database using the SQL Server Management Studio.
I now need to export that so I can import it into my websites empty database.
I've tried Tasks/Generate Scripts but I can't import the file it generates into my database on my site.
I get the following error message:
Could not find stored procedure 'xxx'
I've also tried to Export Data but I don't appear to get a result at the end of the process. Possibly because I'm using the free version of the software?
Are there any other ways to export this data into a .sql file so I can import it?
I'm just moving a site from one server to another - it shouldn't be this difficult!
Any help would be really appreciated!
Try the Microsoft SQL Server Database Publishing Wizard. Available at:
http://www.microsoft.com/en-us/download/details.aspx?id=5498
Use the generated .SQL file with these steps:
http://www.123-reg.co.uk/support/answers/Databases/Windows-MSSQL/how-do-i-import-export-a-mssql-database-793/
I don't know if you've managed to resolve this but I have found that the SQL file saved from SSMS is in Unicode format and the 123-Reg website is expecting plain text. This is what's causing the "Could not find stored procedure..." error message.
Instead of saving the file, copy and paste the text from SSMS into Notepad, then save that. The file should then upload correctly into the remote database.

SQL Management Studio Exporting Data

I currently have a mdf database on management studio and I would like to export the data to a sql file. Exporting the data with the data-source: SQL Server Native Client works fine, but i have no idea where he saved the exported data. Any help?
You need to go in Database->Tasks->Generate Scripts.
Select options there and you will able to generate complete db in SQL Script

Import .sql file in Access

I need to import to Access a .sql database backup file created with MySql .
Is there a way to perform this operation?
You can't restore a MySQL backup into any other database system.
If you want to import the MySQL data into Access, you could export it all into CSV files and import those to Access. You will still need to recreate relationships, defaults, indexes (?) and other data.
You can import SQL Server data into a new Access table. In general, importing is a way to convert data from a different format and copy it into Access. The source table or file is not altered in this process. You can import directly from a SQL Server database using an ODBC connection, a text file exported from SQL Server, or an XML file exported from SQL Server.
To make frequent import operations more convenient, you can automate them by creating a macro or creating a Microsoft Visual Basic for Applications (VBA) procedure. This is useful, for example, when you import data on a regular schedule or you have unusual or complex requirements for importing data.
if you use SQL Server Management studio then you can open the .SQL files and it will give you help in figuring out what syntax works in SQL -- and which doesn't.
For example, if you have a table name that is mis-spelled, SQL Server Management Studio will give you red squigglies under that table name.
I don't see that functionality in Access, and I don't think that it's coming any time soon. Access (Jet) hasn't gotten any new features in almost fifteen years.

How to export data from Excel spreadsheet to Sql Server 2008 table

I want to import data from an Excel file - assume Excel 2003 / .xls - to Sql Server 2008.
Have tried adding a linked server to the JET OLE DB Access driver, and of course it fails on the 64-bit machine.
But when I try to drop the linked server while experimenting, there's another error saying that the linked server already/still exists!
I have also tried changing the Excel driver to 32-bit (regedit tool) but am not sure if it's doing anything, same error is coming up!
Some more details:
Say Table1 in Excel file has 5 columns.
I want to map to Database.dbo.Table1 with 5 columns again, but with different names in table.
Is there a way to do even do such an import?
From your SQL Server Management Studio, you open Object Explorer, go to your database where you want to load the data into, right click, then pick Tasks > Import Data.
This opens the Import Data Wizard, which typically works pretty well for importing from Excel. You can pick an Excel file, pick what worksheet to import data from, you can choose what table to store it into, and what the columns are going to be. Pretty flexible indeed.
You can run this as a one-off, or you can store it as a SQL Server Integration Services (SSIS) package into your file system, or into SQL Server itself, and execute it over and over again (even scheduled to run at a given time, using SQL Agent).
Update: yes, yes, yes, you can do all those things you keep asking - have you even tried at least once to run that wizard??
OK, here it comes - step by step:
Step 1: pick your Excel source
Step 2: pick your SQL Server target database
Step 3: pick your source worksheet (from Excel) and your target table in your SQL Server database; see the "Edit Mappings" button!
Step 4: check (and change, if needed) your mappings of Excel columns to SQL Server columns in the table:
Step 5: if you want to use it later on, save your SSIS package to SQL Server:
Step 6: - success! This is on a 64-bit machine, works like a charm - just do it!!
There are several tools which can import Excel to SQL Server.
I am using DbTransfer (http://www.dbtransfer.com/Products/DbTransfer) to do the job.
It's primarily focused on transfering data between databases and excel, xml, etc...
I have tried the openrowset method and the SQL Server Import / Export Assitant before.
But I found these methods to be unnecessary complicated and error prone in constrast to doing it with one of the available dedicated tools.
In SQL Server 2016 the wizard is a separate app. (Important: Excel wizard is only available in the 32-bit version of the wizard!). Use the MSDN page for instructions:
On the Start menu, point to All Programs, point toMicrosoft SQL Server , and then click Import and Export Data.
—or—
In SQL Server Data Tools (SSDT), right-click the SSIS Packages folder, and then click SSIS Import and Export Wizard.
—or—
In SQL Server Data Tools (SSDT), on the Project menu, click SSIS Import and Export Wizard.
—or—
In SQL Server Management Studio, connect to the Database Engine server type, expand Databases, right-click a database, point to Tasks, and then click Import Data or Export data.
—or—
In a command prompt window, run DTSWizard.exe, located in C:\Program Files\Microsoft SQL Server\100\DTS\Binn.
After that it should be pretty much the same (possibly with minor variations in the UI) as in #marc_s's answer.

How to import excel files into SqlDatabase .mdf file

I have one long excel sheet with books details of a library..can i import this data into a .mdf file.
Yes. Depends on SQL Server version you have installed (for exact instructions) but you use DTS (Data Transformation Services).
Right click on your database and you should see Import data. Wizard will do most of the work, basically it's a next next next operation.
You will need SQL Server Management Studio, and use its Import feature
http://msdn.microsoft.com/en-us/library/ms141209.aspx
Here is a step-by-step guide from the horse's mouth: http://support.microsoft.com/kb/321686