How to write SQL scripts to determine if a file under a path exists?

xiaoxiao2021-03-06  93

For example, I give the path C: /DB.ABC. How do this file exist?

-------------------------------------------------- -------------

Declare @i int

Exec @ i = master.dbo.xp_cmdshell 'DIR C: /DB.ABC', NO_OUTPUT

IF @ i = 0 Print 'exists'

Else Print 'Non EXISTS'

转载请注明原文地址:https://www.9cbs.com/read-96508.html

New Post(0)