乏mily

导航

2013年9月17日 #

在T-SQL中访问远程数据库(openrowset、opendatasource、openquery)

摘要: 1. 启用Ad Hoc Distributed Queries 在使用openrowset/opendatasource前要先启用Ad Hoc Distributed Queries服务,因为这个服务不安全,所以SqlServer默认是关闭的。也就是说: SQL Server 阻止了对组件 'Ad 阅读全文

posted @ 2013-09-17 16:50 乏mily 阅读(349) 评论(0) 推荐(0) 编辑

同一服务器 数据库间 不同表 的查询

摘要: 1.两张表之间无联系:select A.ID,A.UserName from DB1.dbo.Table1 A where A.Account='admin'unionselect B.ID,B.UserName from DB2.dbo.Table2 B where B.Account='admin'2.两张表之间有联系:select * from DB1.dbo.Table1 A , DB2.dbo.Table2 Bwhere A.Account = B.ID-------- or -------select * from DB1.dbo.Table1 Ai 阅读全文

posted @ 2013-09-17 09:49 乏mily 阅读(246) 评论(0) 推荐(0) 编辑