[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2002-06-06
3
Medium Priority
?
523 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 450 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

864 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