SourceDB=e:\VFP98\data\Testdata.dbc;
SourceType=DBC’,
’select * from customer where region="Seattle"’)
go
-- OPENROWSET DSN 示例
/* 注意:如果 SQL Server 是配置为使用本地帐号 DSN 示例可能失败.*/
select * from openrowset(’MSDASQL’,
’DSN=Visual FoxPro Database;
SourceDB=e:\VFP98\data\Testdata.dbc;
SourceType=DBC’,
’select * from customer where country != "USA" order by country’)
go
/* sp_addlinkedserver 示例 */
-- sp_addlinkedserver example with DSN
/* 你需要生成一个 DSN 并使它指向 Testdata 数据库.
修改你的代码以反映 DBC 位置 */
/* 注意:如果 SQL Server 是配置为使用本地帐号 DSN 示例可能失败.*/
sp_addlinkedserver ’VFP Testdata Database With DSN’,
’’,
’MSDASQL’,
’VFP System DSN’
go
sp_addlinkedsrvlogin ’VFP Testdata Database With DSN’, FALSE, NULL, NULL, NULL
go
Select *
FROM OPENQUERY([VFP Testdata Database With DSN], ’select * from customer where region = "Seattle" ’)
go
-- Update using OpenQuery
Update OPENQUERY([VFP Testdata Database With DSN], ’select * from customer where region="WA"’)
set region = "Seattle"
go
/* SP_addlinkedserver example with DSN-less connection */
/* This example also depends on the sample files Testdata.dbc
Modify your code accordingly for differences in location or DBC name */
sp_addlinkedserver ’VFP Testdata Database With No DSN’,
’’,
’MSDASQL’,
NULL,
NULL,
’Driver={Microsoft Visual FoxPro Driver};UID=;PWD=;SourceDB=e:\VFP98\data\Testdata.dbc;SourceType=DBC;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;’
go
sp_addlinkedsrvlogin ’VFP Testdata Database With No DSN’, FALSE, NULL, NULL, NULL
go
Select *
FROM OPENQUERY([VFP Testdata Database With No DSN], ’select * from customer where country != "USA" order by country’)