Excel导入SQL SERVER中
--Excel导入SQL SERVER中
--表结构不存在可以使用
--启用Ad Hoc Distributed Queries:
exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure
select * into serv_user_bak1 from
OpenRowSet('microsoft.jet.oledb.4.0','Excel 8.0;HDR=yes;database=c:\test.xls;','select * from [Sheet1$]')
---使用完成后,关闭Ad Hoc Distributed Queries:
exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure
-----------------------------------------------------------
--表结构存在可以使用
--启用Ad Hoc Distributed Queries:
exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure
insert into serv_user_bak1
SELECT * from
OpenRowSet('microsoft.jet.oledb.4.0','Excel 8.0;HDR=yes;database=c:\test.xls;','select * from [Sheet1$]')
---使用完成后,关闭Ad Hoc Distributed Queries:
exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure
相关文档:
在SQL Server 2005 Express 上附加从另外一台电脑Copy过来的数据库后,数据库为“只读”。
解决办法:
打开 SQL Server Configuration Manager, 打开SQL Server SQLEXPRESS 的属性
在内置帐号处,把“网络服务”改成“本地系统”,重新启动SQL Server 2005 Express 后,再附加数据 ......
Rebuild indexes online with SQL Server 2005
http://blogs.techrepublic.com.com/datacenter/?p=249
Online index rebuild
SQL Server 2005 introduces the ability to rebuild your indexes in an
online fashion so that other processes are able to access the table
while the rebuild is occurring. Because y ......
declare @str varchar(50)
declare @i int
set @str = ''
set @i=0
while @i<50
begin
set @str = ......
下列语句部分是Mssql语句,不可以在access中使用。
SQL分类:
DDL—数据定义语言(Create,Alter,Drop,DECLARE)
DML—数据操纵语言(Select,Delete,Update,Insert)
DCL—数据控制语言(GRANT,REVOKE,COMMIT,ROLLBACK)
首先,简要介绍基础语句:
1、说明:创建数据库
Create&nb ......