国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數(shù)據(jù)庫 > SQL Server > 正文

SQLServer 批量導(dǎo)入目錄文件

2020-07-25 13:31:31
字體:
供稿:網(wǎng)友
openrowset的用法可以參考msdn
http://technet.microsoft.com/zh-cn/library/ms190312.aspx
如果文件很多,建議還是用程序倒入了
復(fù)制代碼 代碼如下:

if (object_id ('t_bulkResult' ) is not null )
drop table t_bulkResult
create table t_bulkResult (name varchar (1000 ), data image )
go
declare @d varchar (1000 )
set @d = 'c:/test/'
create table #tb (fName varchar (1000 ), d int , f int )
insert into #tb exec xp_dirtree @d , 1 , 1
delete from #tb where f <> 1
declare @ sql nvarchar (max )
select @ sql = isnull (@ sql , '' )+ 'insert into t_bulkResult select ''' +@d + fname + ''',* from openrowset(bulk N''' +@d + fName + ''', SINGLE_BLOB) b
'
from #tb a
exec sp_executesql @ sql
drop table #tb
select * from t_bulkResult
發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 威信县| 衢州市| 客服| 白水县| 瓮安县| 长寿区| 北流市| 本溪| 忻城县| 丹凤县| 张家港市| 祁连县| 日照市| 郧西县| 万安县| 樟树市| 瓦房店市| 肥城市| 齐河县| 昌乐县| 迁安市| 都昌县| 棋牌| 崇仁县| 印江| 当雄县| 通州市| 蓝山县| 泾源县| 双辽市| 新干县| 界首市| 云南省| 祁阳县| 扬州市| 宣汉县| 怀宁县| 盖州市| 淮滨县| 平陆县| 平罗县|