抓取指定路径下所有文档名

--方法1:
EXEC xp_dirtree '\\172.6.6.6\D$\TEXT\',1,1

--方法2:
CREATE TABLE #TXT_Name (NAME VARCHAR( 2000))
SET @iSQL='DIR \\172.6.6.6\D$\TEXT\  /ON/B >D:\TEST.TXT'
EXEC master..xp_cmdshell @iSQL,no_output
BULK INSERT #TXT_Name FROM 'D:\TEST.TXT' WITH (BATCHSIZE =1000,FIELDTERMINATOR ='\t',FIRSTROW =1,ROWTERMINATOR ='\n',TABLOCK )

 

posted @ 2017-05-31 10:51  芈璐  阅读(200)  评论(0编辑  收藏  举报