after upgrading sql server express from 2012 to 2016 bcp is not working

  • after upgrading sql server express from 2012 to 2016 bcp is not working

    declare @sql nvarchar(4000)

    select @sql = '

    bcp "select xml_data from fcsd.DBO.XmlImport"

    queryout E:\1.xml -S '+@@servername+' -T -t -c -C 65001'

    exec master..xp_cmdshell @sql;

    ends with:

    output:

    null

    thanks

  • The problem could be the code page you're specifying. 65001 CP is no longer supported.

    Sue

  • the only reason for upgrading to 2016 is the utf-8 encoding witch comes with it

    meanwhile i tried another approach than succeeded:

    set @xml=(select xml_data from FCSD.DBO.XmlImport)

    set @xml_convert=cast(@xml as nvarchar(max));

    IF OBJECT_ID('tempdb..##x') IS NOT NULL DROP TABLE ##x;

    select @xml_convert AS x into ##x;

    set @sql='bcp "SELECT x FROM ##x" queryout c:\1.xml -S '+@@servername+' -T -t -c -C 65001'

    EXEC master..xp_cmdshell @sql

    drop table ##x

Viewing 3 posts - 1 through 2 (of 2 total)

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