How do I check if a directory exists using SQL Server? [closed]

て烟熏妆下的殇ゞ 提交于 2019-11-30 01:32:52

问题


I know this command will create a directory:

EXEC master.sys.xp_create_subdir 'C:\testing\'

But how do I check whether 'C:\testing\' exists?

IF EXISTS(...

回答1:


 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.



来源:https://stackoverflow.com/questions/13765911/how-do-i-check-if-a-directory-exists-using-sql-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!