在线求一个效益较好的从Excel批量导出到Sql Server的方法

puyunsong 2004-09-02 01:26:43
要求用程序来实现
...全文
164 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
specialkid 2004-09-07
  • 打赏
  • 举报
回复
learn ing
puyunsong 2004-09-03
  • 打赏
  • 举报
回复
用DTS程序怎么写啊
有例子没?小弟不大懂,谢谢了。
netcoder 2004-09-03
  • 打赏
  • 举报
回复
用DTS效率比较好,也省事多了
老宛 2004-09-02
  • 打赏
  • 举报
回复
如何在SQL Server存储过程中执行DTS包
http://blog.csdn.net/longrujun/archive/2004/08/02/59128.aspx
老宛 2004-09-02
  • 打赏
  • 举报
回复
如何在SQL Server存储过程中执行DTS包
http://blog.csdn.net/longrujun/archive/2004/08/02/59128.aspx
rouqu 2004-09-02
  • 打赏
  • 举报
回复
UP
老宛 2004-09-02
  • 打赏
  • 举报
回复
用dts吧,然后在前台调用dts包
puyunsong 2004-09-02
  • 打赏
  • 举报
回复
但是当数据量太大的时候,比如有5,6千甚至1万条记录的时候会不会很慢啊
zjcxc 2004-09-02
  • 打赏
  • 举报
回复
--示例

--将某个目录上的Excel表,导入到数据库中

--将所有的Excel文件放到一个目录中,假设为c:\test\,然后用下面的方法来做

create table #t(fname varchar(260),depth int,isf bit)
insert into #t exec master..xp_dirtree 'c:\test',1,1
declare tb cursor for select fn='c:\test'+fname from #t
where isf=1 and fname like '%.xls' --取.xls文件(EXCEL)
declare @fn varchar(8000)
open tb
fetch next from tb into @fn
while @@fetch_status=0
begin
--下面是查询语句,需要根据你的情况改为插入语句
--插入已有的表用:insert into 表 selct * from ...
--创建表用:select * into 表 from ...
set @fn='select * from
OPENROWSET(''MICROSOFT.JET.OLEDB.4.0'',''Excel 5.0;HDR=YES;DATABASE='+@fn+''',全部客户$)'
exec(@fn)
fetch next from tb into @fn
end
close tb
deallocate tb
drop table #t

27,581

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 应用实例
社区管理员
  • 应用实例社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧