SQL Server:加载目录树的快速方法(名称、修改日期)

发布于 2024-09-26 05:28:54 字数 420 浏览 0 评论 0原文

(我寻找答案,但到目前为止没有真正解决我的问题。)

我想用 Microsoft SQL Server 2005 中的文件目录树保持表最新。我现在执行规范:

insert into #resultTable (Path)
exec master.dbo.xp_cmdshell 'dir/s/b G:\FileLibrary'

但这需要大约 4 1/每次加载需要 2 分钟(更何况我还不知道如何获取修改日期)。是的,它是一个网络驱动器,但在本地运行它需要 1 分 16 秒,而且这不是我想要检查的唯一目录。

有没有什么东西可以作为 DLL 或 C# 代码加载到 SQL Server 2005 中,我可以编译这些代码来快速扫描一段时间以来更改的文件(包括夏令时更改)?这些文件存储在 SQL Server 运行的同一台服务器上。

(I looked for an answer, but nothing really solved my issue so far.)

I want to keep a table up to date with a file directory tree within Microsoft SQL Server 2005. I do the norm now:

insert into #resultTable (Path)
exec master.dbo.xp_cmdshell 'dir/s/b G:\FileLibrary'

but this takes about 4 1/2 minutes to load each time (not to mention I don't know how to grab the modified date yet). Yes it's a network drive, but running it locally takes 1 minute 16 seconds, and that's not the only directory I want to check.

Is there something out there I can load in to SQL Server 2005 as a DLL or maybe C# code I can compile to provide a fast scan of files changed since a period in time (including daylight savings changes)? The files are stored on the same server as SQL Server runs.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

疏忽 2024-10-03 05:28:54

网上有很多从 SQL Server 内部运行托管代码的示例。 这是一个示例

这样,您只需让 C# 代码监视目录的更改即可。也许您可以使用这些文章作为起点: 此处此处

还有许多其他链接,快速谷歌搜索就会发现。

There are many examples online of running managed code from inside of SQL Server. This is one example.

With that, you just need to have the C# code monitor the directory for changes. Maybe you can use these articles as starting points: Here and Here.

There are many other links too that a quick Google search will uncover.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文