如何从命令行获取没有破折号字符的 OSQL.exe 结果?
有没有办法从命令行发送 osql 查询,该查询返回的结果不包含代表列宽的长划线字符?
这是我正在使用的示例代码:
echo.
"%PROGRAMFILES%\Microsoft SQL Server\%SQLVER%\Tools\BINN\osql" -S . -E -Q "SELECT name + ', ' FROM sysdatabases order by name for XML PATH('')"
结果如下所示:
-------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
master, model, msdb, openfire, tempdb,
Is there a way to send a osql query from the command line that returns results that do not include the big long line of dash characters that represent the column width?
Here is the sample code I am working with:
echo.
"%PROGRAMFILES%\Microsoft SQL Server\%SQLVER%\Tools\BINN\osql" -S . -E -Q "SELECT name + ', ' FROM sysdatabases order by name for XML PATH('')"
And the results look something like this:
-------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
master, model, msdb, openfire, tempdb,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
-h-1
开关 抑制标头:破折号是标头/数据分隔符“行”相同的开关也可用于 sqlcmd
Use
-h-1
switch to suppress headers: the dashes are the header/data separator "line"The same switch can be used for sqlcmd too