Sql-server – SQLCMD external editor

sql serversqlcmd

I have set the environment variable SQLCMDEDITOR=gvim to invoke an vim with the ED command of SQLCMD. From my old Windows 7 computer, it used to work.

I have now a new laptop (windows 10) and, when attempting the same thing I get, on the same server:

C:\>sqlcmd -S <serverName> 
1> SELECT GETDATE()
2> GO

-----------------------
2019-12-13 09:11:47.493

(1 rows affected)
1> ED
Sqlcmd: Error: Internal error at ExecProcess (Reason: The filename, directory name, or volume label syntax is incorrect).

I have checked that gvim is in the PATH. I have tried to set the variable to: gvim; gvim.exe; C:\Progra~2\Vim\vim81\gvim.exe; notepad.exe. Always the same.

Why is that ?

Best Answer

This looks like a SQLCMD bug. I can repro with SQLCMD 14.0.3026.27 on Windows 10.

I submitted the bug report on the SQL Server feedback site. Consider upvoting the bug report.