ACCESS数据导入到SQL Server2005
在SQL Server2005中选中要导入数据的库 > 右键 > 新建查询:
执行SQL语句如下:
insert into
目标数据库表名 (字段1,字段2,....) select
字段1,字段2... from
openrowset
('microsoft.jet.oledb.4.0',';database=源数据库路径(如:d:\test.mdb)','select * from 源表 where 查询条件')
SQL 语句启用组件Ad Hoc Distributed Queries
1.启用
exec
sp_configure 'show advanced options',1
reconfigure
exec
sp_configure 'Ad Hoc Distributed Queries',1
reconfigure
exec
sp_configure 'show advanced options',0
reconfigure
/*
配置选项 'show advanced options' 已从 1 更改为 1。请运行 RECONFIGURE 语句进行安装。
配置选项 'Ad Hoc Distributed Queries' 已从 1 更改为 1。请运行 RECONFIGURE 语句进行安装。
*/
2.关闭
exec
sp_configure 'show advanced options',1
reconfigure
exec
sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec
sp_configure 'show advanced options',0
reconfigure
相关文档:
Transact SQL 语 句 功 能
========================================================================
--数据操作
SELECT --从数据库表中检索数据行和列
INSERT --向数据库表添加新数据行
DELETE --从数据库表中删除数据行
UPDATE --更新数据库表中的数据 ......
一、使用证书实现主备SQL Server实例的互通
1.在主机和备机上分别创建证书
在主机上执行如下语句:
USE master;
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'abcdefg';
CREATE CERTIFICATE CERT_HOST_A WITH SUBJECT = 'HOST_A certificate' ,
START_DATE = '01/01/2010';
GO
在备机上执行如下语句:
USE master; ......
use master
go
if exists(select * from dbo.sysobjects where id = object_id(N'[dbo].[P_KillConnections]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[P_KillConnections]
GO
create proc P_KillConnections
@dbname varchar(200)
as
declare @sql nvarchar(500)
declare @spid nvar ......
下面是Sql Server 和 Access 操作数据库结构的常用Sql,希望对你有所帮助。
新建表:
create table [表名]
(
[自动编号字段] int IDENTITY (1,1) PRIMARY KEY ,
[字段1] nVarChar(50) default \'默认值\' null ,
[字段2] ntext null ,
[字段3] datetime,
[字段4] money null ,
[字段5] int default 0,
[字段6] De ......
[SQL SERVER] 跨服务器查询
[SQL SERVER] 跨服务器查询
方法一:
用OPENDATASOURCE
下面是个跨SQLServer查询的示例
Select TableA.*,TableB.* from OPENDATASOURCE(
'SQLOLEDB',
'Data Source=ServerA;User ID ......