SQL Server administration and T-SQL development, Web Programming with ASP.NET and Javascript, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software Kodyaz Development Resources
Development resources, articles, tutorials, samples, codes and tools for .Net, SQL Server, Vista, etc.

Software Development



BCP command fails because of "Unknown argument 'ûU' on command line"

The below command is sent to me via Outlook email message.

I connected to my local server using my windows user account as system administrator.

 

Declare @str nvarchar(4000)
Set @str =N'BCP KodyazDB.dbo.Brands out c:\export.txt -S PCKodyaz\yukon –U mysqllogin –P myloginpwd'
Exec master..xp_cmdshell @str
 

Copied and ran. The returned error message is as follows:

Unknown argument 'ûU' on command line. or Unknown argument 'ûP' on command line.

 

Although it seen as -, when I copied the code on a frontpage document I realized that it was converted to – .The Microsoft SQL Server Management Studio is aware of the difference between the characters of - and – but displays them as same.

 

I manually deleted the dashes and rewrite them again.



Declare @str nvarchar(4000)
Set @str =N'BCP KodyazDB.dbo.brands out c:\export.txt -U mysqllogin -P myloginpwd -S PCKodyaz\yukon'
Exec master..xp_cmdshell @str

Returned the following output message:

Enter the file storage type of field BrandId [smallint]:


I added a new argument to the BCP command -c

Declare @str nvarchar(4000)
Set @str =N'BCP KodyazDB.dbo.brands out c:\export.txt -c -U mysqllogin -P myloginpwd -S PCKodyaz\yukon'
Exec master..xp_cmdshell @str

output message is displayed as :
NULL
Starting copy...
NULL
361 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.): total 1
NULL
 

 

This is the happy ending.


 

Published Thursday, November 23, 2006 12:14 PM
Filed Under:

Comments

No Comments
Anonymous comments are disabled

About eralper

Worked with Vignette , developed Tcl/Tk
Copyright © 2004 - 2012 Eralper Yilmaz. All rights reserved.
Community Server, by Telligent Systems