Thanks for quick reply, below is the result
Pls let me know if you need any other information
bcp T1 out D:\Archive -S <Server_Name> -U <username> -P <pwd> -b 10000 -c -t |;
.. is this the actual commandline? It looks a bit fishy in two places.Unless you want your file to be named 'Archive', you haven't supplied a filename, only the directory 'D:\Archive'
..is the delimiter a pipe + semicolon?In any case, a pipe on a commandline acts as a redirection operator, so try enlosing it in quotes.bcp T1 out D:\Archive -S <Server_Name> -U <username> -P <pwd> -b 10000 -c -t "|;"(if the semicolon is just some sort of 'statement-end', just remove it-)
This can also be caused by the account BCP is using, since you are using SQL Login, this will be either:
Your account if excuted from Command line
The SQL Server service account if using xp_cmdshell
SQL Server Agent service account, if it is being executed in a CmdExec or T-SQL with xp_cmdshell step. The account can be configured within the Job as well.
The BCP account needs access to the file, for UNC this includes the share.
A trick for Local Service is to grant the SQL Server Computer account these network permissions.
For UNC with the service using a Domain account, the permissions should be verified by logging in as the service account, browse to the file in question, and run BCP from the cmd line.
specify the name of server
otherwise bcp (executed on cmd line) does not where is T1
Yes, it does. That's what the -S<servername> parameter says...