Import and export between heterogeneous databases

Source: Internet
Author: User
Tags dbase insert odbc mssql table name
Data | database

Import and export between heterogeneous databases

Mssql2excel
adoconnection1.connectionstring:=
' Provider=Microsoft.Jet.OLEDB.4.0;Data Source=g:\mysmallexe\excel2sql\yp.xls; '
+ ' Extended properties=excel 8.0 ';
Adoconnection1.execute (' select * into [ABC]-Drug_yk in [ODBC] [Odbc;driver=sql

Server; Uid=sa; pwd=kcsoft58; Server=127.0.0.1;database=kcsoft_his] ";
To export a MSSQL database table and data to Excel, ABC is a table name that does not exist in Excel, Drug_yk is a table in MSSQL, and SA is

User, kcsoft58 is the password, 127.0.0.1 is the service big address, Kcsoft_his is the database name
Adoconnection1.execute (' INSERT INTO [ABC] SELECT * from Drug_yk in [ODBC] [Odbc;driver=sql

Server; Uid=sa; pwd=kcsoft58; Server=127.0.0.1;database=kcsoft_his] ";
Add the records of a MSSQL database table to Excel and perform the equivalent of twice times the amount of data, one for import and one for

Insert


Excel2mssql
Adoconnection1.connectionstring:= ' Provider=SQLOLEDB.1; password=kcsoft58; Persist Security

Info=true; User id=sa;initial catalog=kcsoft_his;data Source=chen ';
Adoconnection1.execute (' SELECT * into [ABC] from OPENDATASOURCE ('
+quotedstr (' microsoft.jet.oledb.4.0 ') + ', '
+quotedstr (' Data source= ' G:\mysmallexe\excel2sql\yp.xls '; Extended Properties=excel 8.0 ')

+')... [ABC] ');


Mssql2vfp
adoconnection2.connectionstring:=
' Provider=Microsoft.Jet.OLEDB.4.0;Data Source=g:\mysmallexe\excel2sql; '
+ ' Extended properties=dbase 5.0 ';
Adoconnection2.execute (' select * into ABC.DBF-Drug_yk in [ODBC] [Odbc;driver=sql

Server; Uid=sa; pwd=kcsoft58; Server=127.0.0.1;database=kcsoft_his] ";
The database table and data of a MSSQL are exported to VFP, ABC.DBF is the table name that does not exist in VFP, Drug_yk is the table in MSSQL, SA is

User, kcsoft58 is the password, 127.0.0.1 is the service big address, Kcsoft_his is the database name


Vfp2mssql
Adoconnection2.connectionstring:= ' Provider=SQLOLEDB.1; password=kcsoft58; Persist Security

Info=true; User id=sa;initial catalog=kcsoft_his;data Source=chen ';
Adoconnection2.execute (' SELECT * into [ABC] from OPENDATASOURCE ('
+quotedstr (' microsoft.jet.oledb.4.0 ') + ', '
+quotedstr (' Data source= ' G:\mysmallexe\excel2sql '; Extended properties=dbase 5.0 ') + ') ...

[ABC] ');


Mssql2access
adoconnection2.connectionstring:=
' Provider=Microsoft.Jet.OLEDB.4.0;Data Source=g:\mysmallexe\excel2sql\server.mdb; '
+ ' Persist security info=false; Jet oledb:database password=happynewyear ';
Adoconnection2.execute (' select * into ABC-Drug_yk in [ODBC] [Odbc;driver=sql

Server; Uid=sa; pwd=kcsoft58; Server=127.0.0.1;database=kcsoft_his] ";


Access2mssql
Adoconnection2.connectionstring:= ' Provider=SQLOLEDB.1; password=kcsoft58; Persist Security

Info=true; User id=sa;initial catalog=kcsoft_his;data Source=chen ';
Adoconnection2.execute (' SELECT * into [ABC] from OPENDATASOURCE ('
+quotedstr (' microsoft.jet.oledb.4.0 ') + ', '
+quotedstr (' Data source= ' G:\mysmallexe\excel2sql\Server.MDB '; Jet Oledb:database

Password=happynewyear ') + ') ... [ABC] ');


Excel2access
adoconnection2.connectionstring:=
' Provider=Microsoft.Jet.OLEDB.4.0;Data Source=g:\mysmallexe\excel2sql\server.mdb; '
+ ' Persist security info=false; Jet oledb:database password=happynewyear ';
Adoconnection2.execute (' SELECT * into [ABC] from [Excel

8.0;database=g:\mysmallexe\excel2sql\yp.xls]. [abc$] ');

Access2excel
adoconnection2.connectionstring:=
' Provider=Microsoft.Jet.OLEDB.4.0;Data Source=g:\mysmallexe\excel2sql\yp.xls; '
+ ' Extended properties=excel 8.0 ';
Adoconnection2.execute (' SELECT * into ABC from

[G:\mysmallexe\excel2sql\server.mdb;pwd=happynewyear].abc ');


Mssql2txt
adoconnection2.connectionstring:=
' Provider=Microsoft.Jet.OLEDB.4.0;Data Source=g:\mysmallexe\excel2sql; '
+ ' Extended properties=text ';
Adoconnection2.execute (' select * into Abc#txt-Drug_yk in [ODBC] [Odbc;driver=sql

Server; Uid=sa; pwd=kcsoft58; Server=127.0.0.1;database=kcsoft_his] ";


Txt2mssql
Adoconnection2.connectionstring:= ' Provider=SQLOLEDB.1; password=kcsoft58; Persist Security

Info=true; User id=sa;initial catalog=kcsoft_his;data Source=chen ';
    adoconnection2.execute (' SELECT * into [ABC] from OPENDATASOURCE ('
   +quotedstr (') Microsoft.Jet.OLEDB.4.0 ') + ', '
   +quotedstr (' Data source= ' G:\mysmallexe\excel2sql '); Extended properties=text ') + ') ...<

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.