Help with BCP in SQL 2022

  • We have a stored procedure that calls xp_cmdshell in order to use the BCP command.  This SP works in SQL 2017 and 2019, but I am testing SQL 2022 in our environment and this SP does not work.  I'm hoping to get some help in determining what is wrong.

    Error: [Microsoft][ODBC Driver 17 for SQL Server]Unable to load xmlrw.dll while attempting to read xml format file.

    BCP Version: 16.0.1000.6

    SQL Version: Microsoft SQL Server 2022 (RTM-CU4) (KB5026717) - 16.0.4035.4 (X64) May 1 2023 10:34:45 Copyright (C) 2022 Microsoft Corporation Developer Edition (64-bit) on Windows Server 2022 Datacenter 10.0 <X64> (Build 20348: ) (Hypervisor)

    Note: I am able to run the same command on previous versions of SQL

    Things we've tried:

    • Installing ODBC driver 18 for SQL server.  I think BCP continues to use ODBC 17 once this is installed
    • Uninstall ODBC 17.  This causes BCP to fail
    • Install SQL CU4

    Thanks in advance for any help!

  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

  • It may help if you posted the actual xp_CmdShell call that you're making to BCP.

    It also sounds like the default path (at the DOS level) when you simply make a call to BCP is set to the wrong target.  It's been a thousand years since I have to make such a change but I, IIRC, it has to do with what the systems "Environment Variables" are set to.

     

    • This reply was modified 3 months, 3 weeks ago by  Jeff Moden.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • We were able to get this to work by copying xmlrw.dll from another VM to this VM.    I would prefer to understand why this file wasn't in place, but I guess this is a good work around for now.

  • tommiwan wrote:

    We were able to get this to work by copying xmlrw.dll from another VM to this VM.    I would prefer to understand why this file wasn't in place, but I guess this is a good work around for now.

    Crud... definitely didn't want to hear something like that.  We're just starting migration to 2022.  I have the developers edition installed on my laptop.  And admin level search using the Cmd Prompt turned up nothing.  I also have 2017 installed on the same machine.

    What directory did you have to store the copied file in and is that the same directory you pulled the copy from that other machine?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • On a single instance SQL Server 2022 installation, you can find bcp.exe overhere: "C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn"

    With multiple instances, it may be needed to actually provide the correct path for the specific instance. ( didn't test because we don't mix versions )

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • We copied xmlrw.dll from a working machine to the /system32/   and /SysWOW64/ directories on our Azure SQL VM in order to get this working.  I think system32 was probably where it needed to be.

  • tommiwan wrote:

    We copied xmlrw.dll from a working machine to the /system32/   and /SysWOW64/ directories on our Azure SQL VM in order to get this working.  I think system32 was probably where it needed to be.

    Thank you.  I appreciate the feedback.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 8 posts - 1 through 7 (of 7 total)

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