当前位置:数据库 > SQLServer >>

T-SQL: 读取磁盘文件

答案:
数据倒入还是建议用 bcp

if exists (select * from tempdb..sysobjects where id = object_id(N'tempdb..#T'))
   drop table [#T]

Create table #T(id int identity(1,1) not null, remark varchar(8001) null)
Insert into #T
Exec master.dbo.xp_cmdshell 'type e:\data.txt'
select * from #T

剩下就靠你自己 根据"数据类型"  整理 "数据格式" 等了.....

上一个:SQL Server中使用外部命令执行sql脚本
下一个:防范SQL注入攻击的新办法

Oracle
MySQL
Access
SQLServer
DB2
Excel
SQLite
SYBASE
Postgres
如果你遇到数据库难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,