bcp Command

  • Hi!

    I am using bcp command to copy sql server table rows to a text file. When i am running my procedure from the sql environment then it is working fine and creating file as well. but the same programe when i am trying to run from application in Dot Net then it gt hanged 🙁

    please provide me some remedy to resolve this problem.

    bcp CookieSubProd.dbo.EFTFileData out E:\Shared\EFTCreateFiles\RY0102.txt -c -T -S nx-subway01\ar

    Kindest Regards,

    Atif Saeed Khan

  • I assume that your application is running on a different server/work station then the one that your SQL Server is installed on. Do you have BCP utility on that server? What happens if you run the same command from command line utility on the machine where your application runs?

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Afcourse application is running on the same server. Is there anything link to transaction ? because in my application i am using distributed transaction logic. system gt stuck only when it comes to run bcp command. before that it delete and insert data in the desire table on which i want to run bcp command but when it runs .... 🙁

    Kindest Regards,

    Atif Saeed Khan

  • I’m sorry but I’m not sure that I understand you. Are you running the BCP as part of distributed transaction? I don’t think that you can do it. As far as I know BCP will open a session of its own. If you are opening a transaction, then running the BCP and then committing the transaction, this could be the reason that it doesn’t work. Can you post the relevant code?

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • hm u understood my problem. Thanks. hm transaction is the main problem. ok il try another remedy to solve this transaction problem and if i could solve it or not il definatly let u know.

    Kindest Regards,

    Atif Saeed Khan

  • ADI,

    Do you know how I can use BCp to create a tab delimited text file.

    I am attempting to run the following and it is not working.

    Bcp "EXEC usp_nh_oxford" out "\\paragonsql\vardata$\Files\Oxford\paragon.oxford.txt" -c -T

    Thank you

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply