开发者

How to get results from OSQL.exe without dash characters from the command line?

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,


Use -h-1 switch to suppress headers: the dashes are the header/data separator "line"

The same switch can be used for sqlcmd too

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜