SQLCMD - how to Suppress output
by sdragolov » Tue, 24 Oct 2006 02:59:33 GMT
Is it possible to suppress/turn-off the output that is returned from
queries within a script when executing it with sqlcmd utility ?? I
don't want to write the output to a file, just want to turn it off.
Or is the only way to make it into a stored procedure?
Thanks.
Re: SQLCMD - how to Suppress output
by Erland Sommarskog » Tue, 24 Oct 2006 07:51:07 GMT
( XXXX@XXXXX.COM ) writes:
You could redirect output to NUL: to lose it entirely.
Or are there pieces in the output you do want to see?
--
Erland Sommarskog, SQL Server MVP, XXXX@XXXXX.COM
Books Online for SQL Server 2005 at
http://www.**--****.com/
Books Online for SQL Server 2000 at
http://www.**--****.com/
Similar Threads:
1.Suppressing messages using SQLCMD
I'm using SQLCMD to run a long list of relatively small scripts and
using the -o parameter to save the output (and check for errors).
The problem is that a couple of the scripts have cursors and "(1 row
affected)" is written every time. This causes the scripts to taken an
excessive amount of time to run as there are hundreds of thousands of
rows and each one is written to the output file.
I could turn off the -o option for those scripts but then I'd lose all
error information.
Is there a way to do something like this: suppress the "(1 row
affected)" messages and only record errors?
This is SQL 2005.
2.Get sqlcmd output into a table?
I'd like to get the output from the sqlcmd statement !!sqlcmd /Lc into a table.
The cmd runs fine in SSMS and returns the list of SQL Servers in the Results
window. I've tried a number of variations on this approach without success:
CREATE TABLE #tblSQLServers (ServerName [varchar](50))
INSERT INTO #tblSQLServers
!!sqlcmd /Lc
SELECT * FROM #tblSQLServers
Does anyone know of a way to do this?
TIA,
dj
3.sqlcmd output is UTF-8
If I create a simple sqlcmd script:
:out c:\temp\temp2.sql
SELECT 1
GO
:out STDOUT
and run it, the output appears to be UTF-8. This causes problems not least
because SSMS saves code as ANSI. I can open the output files in Notepad and
save them as ANSI, but obviously this is not practical for large numbers of
files.
UTF-8 isn't the problem so much as How can I override it?
Is there any way to override this setting when using sqlcmd mode from SSMS?
thanks
4.sqlcmd output and line break / carriage return
Hello,
I am trying to catch someout put from sqlcmd in CSV format. Its kind
of going will apart from one of the columns is a free text column
(varchar ?) and has line break / carriage return and this is wrecking
the CSV output file .. or more correctly .. Excel is having issues
importing it.
My command is this ..
sqlcmd -S PC2\SQLEXPRESS -i invoiceExceptionsBatch.sql -o ID
Is there anything I can add to remove the line break / carriage
returns ?
Thanks in advance
Regards
Rob
5.SQLCMD Output
Hello,
The documentation says that sqlcmd shows column headers above an output resultset.
That is what I want.
I use the -o parameter (tried the >> operator also) to put the output in a file.
There are no column headers in the file.
Am I missing something? Maybe a switch?
Thank You
Joachim
6. sqlcmd outputs different
7. sqlcmd and Hebrew output
8. sqlcmd csv output