Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2002-06-06
3
483 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
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…

860 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