如何使用SQL Server检查目录是否存在? [英] How do I check if a directory exists using SQL Server?
本文介绍了如何使用SQL Server检查目录是否存在?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道这个命令将创建一个目录:
I know this command will create a directory:
EXEC master.sys.xp_create_subdir 'C:\testing\'
但是如何检查'C:\testing\'是否存在? >
But how do I check whether 'C:\testing\' exists?
IF EXISTS(...
推荐答案
CREATE TABLE ResultSet (Directory varchar(200))
INSERT INTO ResultSet
EXEC master.dbo.xp_subdirs 'c:\'
Select * FROM ResultSet where Directory = 'testing'
将返回子目录列表,然后可以检查列表的内容。
Will return a list of sub directories, you can then check the contents of the list.
这篇关于如何使用SQL Server检查目录是否存在?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文