Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2002-06-06
3
Medium Priority
?
512 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
[X]
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
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
Recently I was talking with Tim Sharp, one of my colleagues from our Technical Account Manager team about MongoDB’s scalability. While doing some quick training with some of the Percona team, Tim brought something to my attention...
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…
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…
Suggested Courses

636 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