none
SQLCMD - Strip White Space

    Question

  • I am using SQLCMD to execute a stored query (file.sql).  There is a huge amount of trailing whitespace in certain fields for some reason (I'm saving to an output file). 

    Is there any way to remove that whitespace?
    Wednesday, May 27, 2009 9:09 PM

Answers

  •  You can use -W switch.

    From BOL :

    -W

    This option removes trailing spaces from a column. Use this option along with the -s option when preparing data that is to be exported to another application. Cannot be used with the -y or -Y options.



    Check http://msdn.microsoft.com/en-us/library/ms162773.aspx


    Madhu


    MCITP, MCTS, MCDBA,MCP-- Blog : http://experiencing-sql-server-2008.blogspot.com/
    • Marked as answer by Jay Mazz Thursday, May 28, 2009 5:04 PM
    Thursday, May 28, 2009 12:11 AM
    Moderator

All replies