Solved

SELECT * INTO .. (to copy a table to SQL Server Database)

Posted on 2002-06-06
3
488 Views
Last Modified: 2012-06-21
I want to copy a table to a SQL Server database from an Access database using the query 'SELECT * INTO .. '
I have two DSNs. The source is Microsoft Access Driver and destination is SQL Server. I am executing this query in the context of Access DSN.

The query I used is: (which is not working)
SELECT * INTO [DSN=GG_SQLSrvr;DRIVER=SQL Server; UID=gg;PWD=****].[deviceinfo_dest] FROM [deviceinfo_src]

The error I am getting is "Could not find file 'C:\Uitls\DSN=GG_SQLSrvr'.

I set the select into/bulk copy option for the destination database in SQL serevr. (If I give a *.mdb file instead of the DSN string it’s working fine. But that’s not my requiremnt.)

1.What is the working query for this purpose? Even if the table 'deviceinfo_dest' does not exist I want to create it with the query.

Regards,
UnniC
mailto: unnic@procsys.com
0
Comment
Question by:unnic
3 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7058788
I fear that this is not possible, at least i couldn't find an indication of that this could work...
CHeers
0
 
LVL 1

Expert Comment

by:johan_brohn
ID: 7058883
Use OPENROWSET in SQL Server instead

SELECT *
INTO New_Table
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
   'C:\Dir\DB.mdb';'user';'password', Table)

OR (no username)

SELECT *
INTO New_Table
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
   'C:\Dir\DB.mdb';;, Table)

0
 
LVL 5

Accepted Solution

by:
spcmnspff earned 150 total points
ID: 7059880
Actually, this is entirely possible. Your missing the letters 'ODBC;' in your connection string.  Try this one:


SELECT * INTO [ODBC;DSN=GG_SQLSrvr;DRIVER=SQL Server; UID=gg;PWD=****].[deviceinfo_dest] FROM [deviceinfo_src]

Otherwise Access assumes that the link is to another jet database . . .

 
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Input Data Using a unique ID from another sheet in Excel 3 58
ORA-02288: invalid OPEN mode 2 76
Pivoting oracle table 9 72
How to structure query with count aggregate 4 41
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question