|
-
Dec 22nd, 1999, 07:51 AM
#1
Thread Starter
Member
Does anyone know how I can copy an Access table using ADO code. I looked in the help for the SELECT INTO statement and I cannot seem to get it to work. The following is an example of what I am trying to accomplish:
rs.open "select * " & _
"into cable IN SQLDATABASE " & _
"FROM MDBDATABASE.TABLE"
Serge Suggested the following; however, I am not sure of the syntax:
Dim cn As New ADODB.Connection
cn.Open "DSN=MyDSN;UID=MyID;PWD=MyPassword;"
cn.Execute "Insert Into SQLTable Select * From AccessTable
Of course, your table structure should be the same in both tables.
This may work, but I want the table to be created as in a select into...Elias
Also, I am not sure of the exact syntax for "AccessTable"
-
Dec 22nd, 1999, 10:00 AM
#2
Guru
Do you need to copy the data AND the table definition at runtime, or just the data?
If you just need the data, read in a recordset, clear the SQL server table, then append all rows from your recordset into the destination table.
I believe you can only copy a table from one DB to another using Jet SQL, not ANSI (standard) SQL or T-SQL (SQL Server).
-
Dec 22nd, 1999, 11:52 AM
#3
Thread Starter
Member
I need the data & the definition. Assume I do not have the table already in SQL.
-
Dec 22nd, 1999, 12:32 PM
#4
-
Dec 25th, 1999, 09:36 AM
#5
Thread Starter
Member
What does the T-SQL code for table creation look like? I don't want to have to give it field sizes, datatypes, etc.
Please help!
-Elias
-
Dec 25th, 1999, 12:23 PM
#6
Guru
Merry Xmas! I pulled this out of SQL server using the Pubs database, authors table...
CREATE TABLE [dbo].[authors] (
[au_id] [id] NOT NULL ,
[au_lname] [varchar] (40) NOT NULL ,
[au_fname] [varchar] (20) NOT NULL ,
[phone] [char] (12) NOT NULL ,
[address] [varchar] (40) NULL ,
[city] [varchar] (20) NULL ,
[state] [char] (2) NULL ,
[zip] [char] (5) NULL ,
[contract] [bit] NOT NULL
)
HTH
Tom
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|