คำตอบ Bcp for export to text format

  • Sunday, July 29, 2012 2:18 PM
     
     

    Hi,

      my server name is SQL-DBA\RA.anan.dbo.test i want load this in to text file using bcp

    Reagards

    Ram's


All Replies

  • Sunday, July 29, 2012 3:10 PM
    Moderator
     
      Has Code

    my server name is SQL-DBA\RA.anan.dbo.test i want load this in to text file using bcp

    I assume your server name is "SQL-DBA\RA" (named instance "RA" on server "SQL-DBA"), your database name is "anan" and the table is "dbo.test".  An example BCP command to export the table to a tab-delimited file is:

    BCP anan.dbo.test out C:\temp\test.txt /S SQL-DBA\RA /T /c

    See http://msdn.microsoft.com/en-us/library/ms162802.aspx for the BCP utility reference.


    Dan Guzman, SQL Server MVP, http://weblogs.sqlteam.com/dang/

  • Sunday, July 29, 2012 4:26 PM
     
     

    where should i run this command


  • Sunday, July 29, 2012 5:17 PM
    Moderator
     
     

    where should i run this command

    You should run the command from the command-prompt as you are apparently doing.

    The error means that the specified instance (SQL-DBA\RA) is can't be reached.  Can you access the server remotely using other applications, like SSMS or SQLCMD?  Can you PING the server?  As the message indicates, the error may be because the server is not configured to allow remote connections.  Another possible cause is that the server specification is incorrect (wrong server or instance name).


    Dan Guzman, SQL Server MVP, http://weblogs.sqlteam.com/dang/

  • Sunday, July 29, 2012 6:46 PM
     
     

    HI check my blog for more information on BCP

    http://sqlservr.blog.com/2012/04/09/how-to-take-backup-of-a-single-table/


    Ramesh Babu Vavilla MCTS,MSBI

  • Sunday, July 29, 2012 6:46 PM
     
     
    please check the instance name ,it missing

    Ramesh Babu Vavilla MCTS,MSBI

  • Monday, July 30, 2012 3:11 AM
     
     

    Everything seems so correct. Could you run the following command and see if you get to see anything different!

    BCP anan.dbo.test out "C:\temp\test.txt" /SSQL-DBA\RA /T /c

    All I have modified is the double quotes around the path!


    See if this works out for you. Good Luck! Sumit M.

  • Tuesday, July 31, 2012 6:17 AM
     
     Answered

    hi check the screenshot attached ,it is testes and working too

    please give single space after -s ServerName


    Ramesh Babu Vavilla MCTS,MSBI


    • Proposed As Answer by vr.babu Tuesday, July 31, 2012 6:17 AM
    • Edited by vr.babu Tuesday, July 31, 2012 6:21 AM
    • Marked As Answer by amber zhangModerator Monday, August 06, 2012 2:01 AM
    •