Replacement for -n operation of OSQL in SQLCMD
-
Monday, February 06, 2012 11:45 AM
Hi ,
We are into migration from SQL Server 2000 to SQL Server 2008 R2.
So I am planning to replace osql commands with sqlcmd
In one of the job steps, the output of a stored procedure is loaded into an output CSV file where we use the -n operation(removes numbering)
osql -E -dtest -Q"exec sql_cmd" -o"D:\test\sql_cmd.csv" -s"," -w400 -n -b
when i execute the above line I get the below error:
-n is an obsolete operation and is ignored
Any kind of help is highly appreciated.
Thanks,
sraja
All Replies
-
Monday, February 06, 2012 12:54 PMSQLCMD not support -n option also this option not even support OSQL from SQL 2005
http://uk.linkedin.com/in/ramjaddu -
Tuesday, February 07, 2012 6:03 AM
Hi Ram,
Thanks for your reply. Is there any workaround to implement this option in SQLCMD?
Thanks.
-
Tuesday, February 07, 2012 10:08 AMModerator
Hi sraja,
Unfortunately, sqlcmd doesn't support -n option. In sqlcmd, there are two new options: -W and -k.
Please refer to:
-k[ 1 | 2 ] remove[replace] control characters
Removes all control characters, such as tabs and new line characters from the output. This preserves column formatting when data is returned. If 1 is specified, the control characters are replaced by a single space. If 2 is specified, consecutive control characters are replaced by a single space.-W remove trailing spaces
This option removes trailing spaces from a column. Use this option together with the -s option when preparing data that is to be exported to another application. Cannot be used with the -y or -Y options.Best Regards,
Iric
Please remember to mark the replies as answers if they help and unmark them if they provide no help.- Marked As Answer by Iric WenModerator Thursday, February 16, 2012 7:19 AM

