确定这是 SQL Server 作业吗? [英] OK for this to be a SQL Server job?

查看:24
本文介绍了确定这是 SQL Server 作业吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文件夹,其中包含用于使用徽章的图像.我有另一个文件夹,其中包含图像的重命名版本(该文件夹在另一台机器上).

I have a folder that contains images for use badges. I have another folder that contains renamed versions of the images (this folder is on another machine).

我需要创建一个进程来复制和重命名找到的任何新图像.名称之间的映射在 SQL Server DB 中.

I need to create a process that will copy and rename any new images found. The mapping between the names is in a SQL Server DB.

将其创建为 SQL Server 作业并使用 xp_cmdshell 复制文件是否是一个坏主意?这是我的第一直觉,但我之前没有这样做过,所以我很好奇是否有任何我应该知道的问题......

Would it be a bad idea to create this as a SQL Server job and use xp_cmdshell to copy the files? This was my first instinct, but I haven't done this before so I was curious if there were any gottchas i should know about...

推荐答案

考虑到大多数关于 SO 的简单问题都在 内得到解答,而您53 分钟前(在我写这篇文章的时候)问过这个问题,但没有答案表明没有人做过,或者没有人以某种方式有任何强烈的感受.

Considering most simple questions on SO are answered in seconds, and you asked this one 53 minutes ago (at the time I'm writing this) and have no answers suggests nobody has done it, or nobody has any strong feelings one way or the other.

根据我自己的经验,我有时会考虑到这一点,但总是选择反对.原因总是一样,有问题的操作随着时间的推移变得更加复杂,并且在应用程序代码中更好地处理.所以结果证明在应用程序代码中更容易处理它,并将结果存储在数据库中.

In my own experience I have sometimes found myself considering this, and always chosen against it. The reason always turns out the same, the operation in question becomes more complicated over time, and is better handled in application code. So it turns out to be easier to handle it in app code, and to just store the result in the database.

几年前,由于这种模式,我不再考虑它并从常规练习列表中删除了这个选项.

Some years ago I stopped thinking about it and crossed this option off the list of regular practice, owing to that pattern.

还有一件事(记得我说过我不再考虑它了吗?),我在回答你的另一个问题时记得.这是因为 shell 正在使用服务器的权限执行.您通常必须授予服务器通常不会拥有的权限,这是不好的做法.

One more thing (Remember I said I never think about it anymore?), which I remembered in answering your other question. It's because the shell is executing with the server's permissions. You often have to give the server privileges it would not normally have, which is bad practice.

这篇关于确定这是 SQL Server 作业吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆