Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道这个命令会创建一个目录:
EXEC master.sys.xp_create_subdir 'C:\testing\'
但是如何检查“C:\testing\”是否存在?
IF EXISTS(...
CREATE TABLE ResultSet (Directory varchar(200)) INSERT INTO ResultSet EXEC master.dbo.xp_subdirs 'c:\' Select * FROM ResultSet where Directory = 'testing'
会返回一个子目录列表,然后可以查看列表的内容。