Referencesįor more information about sp_addlinkedserver, search for sp_addlinkedserver in the Transact - SQL Reference Help file. A linked server named VFP has been added. =MESSAGEBOX(L_Server,32,'Query Failed')Īfter running the code snippet, open SQL Server Enterprise Manager and expand the Linked Servers node. QRYVal=SQLExec(gnConnHandle,SQLCommand,'SQLRESULTS') SQLCommand="SELECT * FROM OPENQUERY(VFP,'SELECT * FROM CUSTOMER')" The TCP/IP server port number that is assigned to the Db2 database system. It consists of the following parts: The domain name or IP address of the Db2 database system. * The linked server doesn't exist, so display a message ) Specifies the Db2 database system to which the connection is made. * The linked server exists, so run the query IF "VFP' ALREADY EXISTS."$UPPER(s_failed) * Test for existence of linked server with aerror() * The Linked Server either already exists or the command failed. * The linked server was successfully created "SourceDB="+Source_Path+"DATA\TESTDATA.DBC SourceType=DBC NULL'"* CREATE the LINKED Server"Ĭreate_Linked_Server=SQLExec(gnConnHandle,SQLCommand) The user, Username, must have permissions to perform these operations on the database. This code snippet assumes that Visual FoxPro and SQL Server are being run on the same machine. The following code snippet adds the Visual FoxPro database Testdata.DBC from the SAMPLES\DATA directory to SQL Server as a linked server. Interpreted by the OLE DB =] 'location' Is the location of or path to theĭatabase as interpreted by the OLE =] 'provider_string' Is the OLE DB =] 'catalog' Is the catalog to be used when making a Source to add as a linked =] 'provider_name' Is the unique provider identifier of theĭata =] 'data_source' Is the name of the data source, as The syntax for adding a linked server from Transact - SQL is: sp_addlinkedserver =] =] =] =] =] =] =] =] 'server' Is the name of the linked server toĬreate with =] 'product_name' Is the product name of the OLE DB data sp_addlinkedserver creates a linked server, which allows access to distribute, heterogeneous queries against OLE DB data sources. Sp_addlinkedserver is a new stored procedure introduced in SQL Server 7.0 and SQL Server 2000. This article shows how to programmatically add and query a Visual FoxPro data source as a linked server from Visual FoxPro. This feature provides access to distribute, heterogeneous queries against OLE DB data sources. SQL Server 7.0 and SQL Server 2000 allows the addition of external data sources as linked servers. Original product version: Visual FoxPro Original KB number: 199131 Summary This article introduces how to programmatically add and query a Visual FoxPro data source as a linked server from Visual FoxPro.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |