0% found this document useful (0 votes)
95 views

Uploading Data From Access To SQL Server

1. The document provides steps for importing data from Microsoft Access into Microsoft SQL Server using ODBC, beginning with importing data into an Access table from Excel. 2. It outlines creating a machine data source in Access to connect to SQL Server, then exporting the Access table to a temporary table in SQL Server named to avoid overwriting existing tables. 3. The final step is to copy data from the temporary Access imported table into the actual SQL Server table using an INSERT statement.

Uploaded by

Expert Tutor
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
95 views

Uploading Data From Access To SQL Server

1. The document provides steps for importing data from Microsoft Access into Microsoft SQL Server using ODBC, beginning with importing data into an Access table from Excel. 2. It outlines creating a machine data source in Access to connect to SQL Server, then exporting the Access table to a temporary table in SQL Server named to avoid overwriting existing tables. 3. The final step is to copy data from the temporary Access imported table into the actual SQL Server table using an INSERT statement.

Uploaded by

Expert Tutor
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

Importing Data from Access to SQL Server

Let’s start off with the simplest table… Regions

Import your data from Excel into Access. At this point, your table is ready for uploading directly into SQL
Server.

Uploading data from Access to SQL Server.


To upload data to a SQL Server, one efficient method is to use ODBC.
1. To begin this process, make sure that the table you are trying to upload is CLOSED in Access. To
close a table, right-click on its tab, and select “Close”.

2. In the left-hand side of your screen, you should see the tables listed. Right-click on the table you
want to export. This will open a menu. Select the “Export” option from this menu, and the
“ODBC Database” option from the next sub-menu.
3. You will be prompted to give the table a name. As long as the table is named something OTHER
THAN a table that already exists in SQL Server, any name will work. I like to name my tables
Tmp[something]. That allows me to easily identify which are ones my temporary tables that I’ve
imported from Access as opposed to the real ones that I created using the Create Table
statements from the project instructions. I do not want to overwrite the tables I already created
from the Instructions. They contain the correct primary and foreign key constraints, which I do
not want to lose. Therefore, I want to copy the data from my Access imported tables into my
existing SQL Server tables. Notice in the screen below, my table is named TmpRegions.

4. After clicking OK for the table name, you will see a screen that allows you to select the Data
Source. Click the “Machine Data Source” tab.
The first time you upload a table to SQL Server, you will need to create a new data source. After
the first time, the data source you created will appear in the list of data sources on the Machine
Data Source tab. The following are instructions for creating a Machine Data Source the first
time. On the screen below, click the New button.

You may get the following warning. Don’t worry about it and just click OK.

5. The next screen should have “User Data source (Applies to this machine only)” already selected
for you. Just click the Next button.
6. Scroll down to the bottom of the listbox on the next screen and select SQL Server.

7. Click the Finish button on the next screen.


8. The next screen will prompt you to give your machine data source a name and description. Fill it
in as follows. You will also need to select the Server from the combobox. If you have already
installed SQL Server on your computer, you should see at least one item in the list of available
servers. If it is not shown in the list of servers, type in the server name as it appears on the login
screen when you launch SQL Server. This is shown below.
9. On the next screen, make sure that “With Windows NT authentication using the network login
ID” is selected and check the box that says “Connect to SQL Server to obtain default settings for
the additional configuration options.” Click Next.
10. This is VERY important: On the next screen, click the “change the default database to:” and
select the database that you created for the this lab. I created one called CMSProject for this
demonstration. The other items that are checked on the screen are the default values. Just
make sure that your screen looks like the one below (but with your database name selected).
Click the Next button.
11. Accept the default settings on the next screen. They should look like the ones in the picture
below. Click the Finish button.
12. The next screen allows you to test your connection. Click the Test Data Source button.

13. You should see a screen that looks like the one below. Click OK.
14. You should be back at the Test Data Source screen. Click OK on this screen.
15. The data source you just created should now appear in the Select Data Source dialog box. Select
it and click OK.

16. You should then see a confirmation screen saying that your table was successfully exported.
Click OK and check in SQL Server to make sure it exists.
One of the main reasons for performing this exercise is to expose you to new and effective ways of
importing, exporting, and manipulating data.

I like to use Access to massage my tables (both rows and columns) into the correct format. Then, I
upload them to SQL Server. Once they are in SQL Server, I simply execute the command to insert the
data from my tmp table into a real one using the following command:

INSERT Regions
SELECT * from tmpRegions

The key is that your columns in the tmp table have to match the columns in the real table. Before I
upload from access, I always add, delete, and rearrange the columns such that they match the real SQL
Server tables exactly. Thus, when I upload and dump the data, it easily pours itself into the real table
with the Update command.

You might also like