zoukankan      html  css  js  c++  java
  • 在SQL 脚本中进行 文件的读写

    首先需要开启xp_cmdshell

    sp_configure 'show advanced options',1
    reconfigure
    go
    sp_configure 'xp_cmdshell',1
    reconfigure
    go


    然后再SQL中插入:

    Declare @Path varchar(5000)
    Set @Path='E:\Test.txt' 
    declare @Command varchar(5000)
    set @Command='echo "Hello World Rex">' + @Path
    exec master..xp_cmdshell @Command


    Declare @Path varchar(5000)
    Set @Path='E:\Test.txt' 
    declare @Command varchar(5000)
    set @Command='echo "'+@MyVarible+'">' + @Path
    exec master..xp_cmdshell @Command


  • 相关阅读:
    10.7
    10.5
    周六
    周五
    周四
    周三
    四则运算
    zabbix——yum安装
    Stirling's Formula
    CONTRASTIVE REPRESENTATION DISTILLATION
  • 原文地址:https://www.cnblogs.com/jiangu66/p/3038645.html
Copyright © 2011-2022 走看看