易截截图软件、单文件、免安装、纯绿色、仅160KB

SQL Server连接远程数据源

SQL Server连接远程数据源的基本方法有下面三种:
OPENDATASOURCE
: The OPENDATASOURCE function is used to
specify connection information for a remote data source by specifying
the OLE DB provider and an initialization string. OPENDATASOURCE can be
used directly within a SELECT, INSERT, UPDATE, or DELETE statement.
 
OPENROWSET
: The OPENROWSET function is used to specify
connection information for a remote data source and the name of an
object that will return a result set (such as a stored procedure) or a
query that will return a result set. Like OPENDATASOURCE, OPENROWSET
can be used directly within a SELECT, INSERT, UPDATE, or DELETE
statement.
 
Linked servers
: A linked server is an object within SQL
Server that defines the connection properties of another SQL Server.
When defined, queries can connect to the remote server using a
four-part name, such as
SQLSrv1.AdventureWorks.person.Contact
The four-part name identifies the server (SQLSrv1), the database
(AdventureWorks), the schema (Person), and the object (Contact table).
Linked servers are explored in more depth in the final section of this
chapter.
 
其中OPENDATASOURCE和OPENROWSET方法一般用来做临时查询(ad hoc query),如果需要经常的查询远程数据,则建议创建linked servers。但是,默认情况ad hoc query 是禁用的,需要手动启动:
sp_configure ‘show advanced options’, 1;
GO
RECONFIGURE;
GO
sp_configure ‘Ad hoc Distributed Queries’, 1;
GO
RECONFIGURE;
 
然后,就可以使用OPENDATASOURCE 查询远程数据库了,OPENDATASOURCE 基本语法如下:OPENDATASOURCE ( provider_name, init_string )。示例代码如下:
SELECT *
from OPENDATASOURCE(‘SQLNCLI’,
‘Data Source=SQL08;Integrated Security=SSPI’)
.Sales.dbo.Customers
上述代码从SQL08服务器上读取Sales数据库的Customers表的内容。
 
也可以通过OPENROWSET方法查询远程数据库,OPENROWSET和OPENDATASOURCE方法相似,基本的差异是
OPENROWSET总是返回结果集,而OPENDATASOURCE方法除了可以返回结果


相关文档:

SQL快速用启动


开启各种服务
      @NET stop SQLSERVERAGENT
      @NET stop MSSQLServerOLAPService
      @NET stop msftesql
      @NET stop MsDtsServer
      @NET stop SQLWriter
  ......

SQL Server2005 Analysis Services展示 OLAP

通过EXCEL导入SSAS项目
(1)本地配置HTTP
主要步骤:
I)新建目录olap,拷贝文件将 %Installation folder%\OLAP\bin\isapi 目录的内容,主要是msmdpump.dll和msmdpump.ini;
II)建立虚拟目录olap, 配置msmdpump.dll,目录安全性选择匿名访问和windows集成。 
http://www.microsoft.com/china/technet/prodtechn ......

在SQL SERVER 2008 中附加MDF&LDF

首先启动SQL SERVER的服务
连接后 在数据库上右键
选择附加。。。
点击 添加。。。
在跳出框内找到你的MDF文件位置 选中 添加进去
相同文件夹内的LDF文件自动加上
完成~~(*^__^*) 嘻嘻……
OK啦 呵呵
初学初学~希望也能帮到其他像我一样的初学者
大家一起加油吧!O(∩_∩)O~ ......

SQL Server的一些系统变量

SQL Server的一些系统变量
sp_configure 'min server memory' --服务器最小内存gosp_configure 'max server memory' --服务器最大内存'gosp_configure 'index create memory'--创建索引占用的内存go--sp_configure 'min  memory per query'--每次查询占用的最小内存
--获取I/O工作情况select --  @@id_bus ......

hibernate 生成的 sql 语句 ? 代值

转自: http://hi.baidu.com/beanchx/blog/item/ed056509d66f65cc3bc763f4.html
p6spy的替代品:jdbc logger
2007年09月13日 下午 01:07
首先介绍一下这个开源的项目。这个是一个对jdbc中的sql进行logger的一个工具。若在项目中采用了较多的preparedStatement,那么打印出来的sql会有很多"?",非常不方便。有一个产品为p ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号