Home > Database > Mysql Tutorial > body text

从Excel把数据导入到MSSql2005

WBOY
Release: 2016-06-07 14:54:32
Original
1319 people have browsed it

用excel把数据导入到mssql2005 、2000应该都是可以。 Excel 导入数据 sqlserver ----------- /*** ** System:window7 ** DB:MsSQLServer2005 ** dbFile:2003 Excel **/ /** 注意事项: ** 1. 以管理员身份登录SQL Server 外围应用配置器,然后点击功能外围应

用excel把数据导入到mssql2005 、2000应该都是可以。 Excel 导入数据 sqlserver
-----------  
/***  
** System:window7  
**  DB:MsSQLServer2005  
** dbFile:2003 Excel  
**/  
/** 注意事项:  
** 1. 以管理员身份登录SQL Server 外围应用配置器,然后点击功能外围应用配置器选中  
** 既席远程调用和ole自动化  
** 2. 重新启动mssqlserver 服务  
**  3. 确保dbfile文件处于非活动状态(不要打开或有程序在读)  
** 4.确保dbfile的列数与表结构一致  
**/  
----------------  
exec sp_configure 'show advanced options',1  
reconfigure  
exec sp_configure 'Ad Hoc Distributed Queries',1  
reconfigure  
EXEC sp_configure 'show advanced options', 1   
GO   
RECONFIGURE   
GO   
EXEC sp_configure 'Ad Hoc Distributed Queries', 1   
GO   
RECONFIGURE   
GO  
prconfigure  
create table student  
(  
id int identity primary key,  
name varchar(50) ,  
sex tinyint,  
mark varchar(50)  
)  
insert   into   student(name,sex,mark)     
  SELECT   *  from  
  OPENROWSET('MICROSOFT.JET.OLEDB.4.0'  ,  
     'Excel 5.0;HDR=YES;DATABASE=e:\\testdata.xls',sheet1$)  ;  
select * from student ;
Copy after login
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!