使用 T-SQL 查询文件系统文件夹 [英] Using T-SQL to Query a File System Folder
本文介绍了使用 T-SQL 查询文件系统文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以从 SQL Management Studio 中查询 TSQL 中的文件夹并返回文件名列表?如果是这样,如何?
Is it possible to query a folder in TSQL, from SQL Management Studio, and return a list of file names? If so, how?
推荐答案
您可以使用 xp_cmdshell.
You can use xp_cmdshell.
示例:
EXECUTE master.dbo.xp_cmdshell 'DIR "C:\YourDirectory\" /A-D /B'
有一个很好的完整示例,有更多选项 此处.
There's a good, full example with more options here.
这篇关于使用 T-SQL 查询文件系统文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文