Re-indexing Windows Internal Database problem...

Answered Re-indexing Windows Internal Database problem...

  • Tuesday, November 04, 2008 6:42 AM
     
      Has Code
    Hi all;

    I want re-index my Windows Internal Database, but when I execute the following command, the following error message appears. How can I overcome the problem?

    E:\>sqlcmd -S np:\\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query –i e:\WsusDBMaintenance.sql
    Sqlcmd: ':\\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query -i e:\WsusDBMaintenance.sql': Unexpected argument. Enter '-?' for help.

    E:\>



    Thanks.

All Replies

  • Thursday, November 06, 2008 11:23 AM
    Moderator
     
     
    Hi,

    For the re-indexing issue, I'd like to use the Microsoft public technet forum for SQL which would be the most relevant forum for your question.

    TechNet Forums » SQL Server

    http://forums.microsoft.com/TechNet/default.aspx?ForumGroupID=93&SiteID=17
  • Thursday, November 06, 2008 5:44 PM
    Moderator
     
     Answered
    The problem is... as indicated by the error... 

    Sqlcmd:
         ':\\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query -i e:\WsusDBMaintenance.sql':
         
    Unexpected argument. Enter '-?' for help.


    simply an unexpected argument in the command string.

    sqlcmd -S np:\\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query –i e:\WsusDBMaintenance.sql


    As documented in Appendix I of the WSUS Operations Guide
    http://technet.microsoft.com/en-us/library/cc708594.aspx

    The syntax is:
    sqlcmd -S np:\\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query –i <scriptLocation>\WsusDBMaintenance.sql

    which is what you appear to have...

    but yet SQLCMD is reporting the argument ':\\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query -i e:\WsusDBMaintenance.sql' as an unexpected argument.

    Note that the 'np' was ignored on the start of the value of the -S parameter, as was the -i. Essentially, at this point, SQLCMD has no argument prefix, so doesn't know what to do with the rest of the line. But the fact that the np is not included in the error tells me that this part : sqlcmd -S np made perfect sense to the parser, but it was the next character encountered after the 'np' that threw it the curve. My guess is that there's an unprintable character (or possibly a space) buried between the 'np' and the rest of the argument.

    My first suggestion would be to retype the command. It is syntactically correct as printed in the WSUS Operations Guide Appendix I.

    On the off chance that you copied the text from the webpage (rather than using the Copy Code hyperlink), I would suggest using the Copy Code link provided in the code block window - as copying direct from the webpage may well have introduced an unwanted character in the text string.
    Lawrence Garvin, M.S., MCITP(x2), MCTS(x5), MCP(x7), MCBMSP
    Principal/CTO, Onsite Technology Solutions, Houston, Texas
    Microsoft MVP - Software Distribution (2005-2009)
  • Friday, November 07, 2008 1:08 PM
     
     
    Yes, your are right. Re-typing the command solved my problem.
  • Monday, September 10, 2012 4:40 PM
     
     

    No that's no the reason. I have faced myself this issue and after 2 weeks of research I found the issue. The problem is the SQLCMD is not capable to distinguish the special character "-" so what you have to do is use the following command:

    --First go to the SQLCMD.exe path

    cd C:\Program Files\Microsoft SQL Server\90\Tools\Binn

    --Then run the following command:

    SQLCMD.EXE -E -S np:\\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query /i G:\SQL_Backup\scripts\backupDB.sql

    As you can see I'm using the "/i" instead "-i". I have created an automated process to run a backup script daily, hope it helps!