Home > Database > Mysql Tutorial > SQL 分布式查询、插入递增列示例

SQL 分布式查询、插入递增列示例

WBOY
Release: 2016-06-07 18:01:02
Original
1094 people have browsed it

SQL 分布式查询、插入递增列示例代码,需要的朋友可以参考下。

代码如下:
truncate table TestTable

EXEC sp_configure 'show advanced options', 1; -- 开启高级配置
RECONFIGURE
EXEC sp_configure 'Ad Hoc Distributed Queries', 1;--开启分布式查询
RECONFIGURE

set IDENTITY_insert TestTable on --设置 某表允许插入递增量

INSERT INTO TestTable(ID,Date,Info )SELECT a.ID,a.Date,a.Info
FROM OPENROWSET('SQLOLEDB','V';'sa';'123456',
'SELECT * FROM TestDatabase.dbo.TestTable') AS a

set IDENTITY_insert TestTable OFF --设置 不某表允许插入递增量

EXEC sp_configure 'Ad Hoc Distributed Queries', 0;--关闭分布式查询
RECONFIGURE

EXEC sp_configure 'show advanced options', 0;--关闭高级配置
RECONFIGURE
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template