Integrate SQL data and Access data into a data set

xiaoxiao2021-03-05  27

Sometimes we have to obtain some of the data in SQL's database, while another part of data is in the Access database, but sometimes you need to associate data in the two databases, and integrate them in a data collection. It is a good way to follow this, you can perform SQL data and Joint queries for SQL data and Access data without SQL connection database statements.

First, you have to perform the following scripting 01_addlinkserver.sql, 01_addlinkserver.sql, as follows:

Use master

Exec sp_addlinkedServer @ server = 'valinkmdb', @ srvproduct = ', @ proviker =' microsoft.jet.Oledb.4.0 ', @ DataSRC =' c: /mcmo.mdb'go

Exec sp_addlinkedsrvlogin @rmtsrvname = 'valinkmdb', @useself = 'false'go

Valinkmdb is an analog Access database that confirms the security-link server> project on the EnterpriseManager of SQL Server, confirm that ValinkMDB's Entry is made. Then you can directly query the data in the acess database on the SQL query analyzer, such as: select * from valinkmdb ... test, TEST here is the name of the table you want to query in the Access database, of course At this time, you can also engage in combination, such as: select * from valinkmdb ... test inner join sqldatabase on sqldatabase .number = test .number

You can apply in ASP or .NET or other languages

If you have any questions, please share a joint exchange.

转载请注明原文地址:https://www.9cbs.com/read-35713.html

New Post(0)