How to execute sqlcmd from powershell?

前端 未结 7 1514
忘掉有多难
忘掉有多难 2020-12-29 05:11

I have a string in powershell, which contains a native sqlcmd command. The command itself can be executed successfully in cmd.exe. I have difficulty in executing them in pow

7条回答
  •  渐次进展
    2020-12-29 06:10

    To call a Win32 executable you want to use the call operator & like this:

    & sqlcmd -S "(local)\instance1" -U a -P a -i "c:\temp\sql.sql"
    

提交回复
热议问题