access|server|sqlserver| Data | The database executes SQL statement implementations by using SQL Server's Query Analyzer:
I. Import access data into SQL Server
Executing the following statement in SQL Server enables you to import data from the B04 table in Access into the Sqltablenaem table in SQL Server
INSERT into Sqltablename (SFIELD1,SFIELD2,SFIELD3,SFIELD4,SFIELD5,SFIELD6)
SELECT CONVERT (char, afield1), Afield2,afield3,afield4,afield5,afield6
From OpenDataSource (' microsoft.jet.oledb.4.0 ', ' Data source= ' C:\doc\accessdb.mdb '); Jet oledb:database password=abc) ... B04
Description
1.CONVERT (char (), afield1) can convert the type of data to control the length;
2. In "OpenDataSource" (' microsoft.jet.oledb.4.0 ', ' Data source= ' C:\doc\accessdb.mdb '; Jet oledb:database password=abc) ... B04 "Medium Data source=" C:\doc\accessdb.mdb the physical path to the Access database (guaranteed two databases on a single machine);
3.PASSWORD=ABC "ABC" is the password of the Access database, if the database is not filled out without a password;
4.B04 is the name of the table in the Access database;
5. You can also add some conditions, such as where afield= ' a ' and ..., import data with selection criteria
Two. Import SQL Server data into Access
Execute the following code in SQL Server Query Analyzer
INSERT into OpenDataSource (' microsoft.jet.oledb.4.0 ', ' Data source= ' C:\doc\accessdb.mdb '); Jet oledb:database password=abc) ... B04 (AFIELD1,AFIELD2,AFIELD3,AFIELD4,AFIELD5,AFIELD6)
SELECT Sfield1,sfield2,sfield3,sfield4,sfield5,sfield6
From Sqltablename
Description
1. You can also add some conditions, such as where afield= ' a ' and ..., with the import data of the selection criteria.
Summarize:
This is an INSERT statement that uses only one form of insert and other forms that can be used for data transduction.
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.