gpt4 book ai didi

sql - sp_OAMethod 'OpenTextFile' 澄清

转载 作者:行者123 更新时间:2023-12-04 22:47:09 25 4
gpt4 key购买 nike

即使在我正在使用的 Microsoft 网站上,我似乎也能找到答案:

EXECUTE @RetCode = sp_OAMethod @FileSystem, 
'OpenTextFile',
@FileHandle OUTPUT,
@FilePath,
8,
1

我想知道 finale int 参数 (1) 的作用以及对此还有哪些其他选项。我试验并使用了 2,但没有发现任何区别。

我知道倒数第二个 int 参数 (8) 指定了 append vs using 2 a write 但也不知道此参数的其他值。

最佳答案

sp_OAMethod 正在执行给定对象的方法,在这种情况下是 FileSystemObject
OpenTextFile 按以下顺序有 4 个参数:

  1. FilePath -Required. The name of the file to open
  2. Mode - Optional. How to open the file
    • 1 = Reading - Open a file for reading. You cannot write to this file.
    • 2 = Writing - Open a file for writing.
    • 8 = Appending - Open a file and write to the end of the file.
  3. Create - Optional. Sets whether a new file can be created if the filename does not exist. True indicates that a new file can be created, and False indicates that a new file will not be created. False is default.
  4. Format - Optional. The format of the file
    • 0 = TristateFalse - Open the file as ASCII. This is default.
    • 1 = TristateTrue - Open the file as Unicode.
    • 2 = TristateUseDefault - Open the file using the system default.


在您的情况下,(8)是 Mode ,(1)是 Create
您可以阅读有关它的更多信息 here

关于sql - sp_OAMethod 'OpenTextFile' 澄清,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20272531/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com