BulkCopy from source table to destination table with a column whose type is different

來源:互聯網
上載者:User

/*Author: Jiangong SUN*/


I've encountered a problem when I do a sql bulk copy from a table in staging to the same table in production. Except for a same column has different types.

So when i synchronize the data, I have the following error:

The locale id '0' of the source column 'EntityId' and the locale id '1033' of thedestination column 'EntityId' do not match.

Whereas it's not the source of the error.


After strugling several hours, a solution is to use a CONVERT when I synchronize the data.

SELECT Id, CONVERT(varchar(60), EntityId) as EntityId  FROM @TABLENAME WITH (NOLOCK) WHERE ID = @ID


Hope this helps! 

Enjoy coding!

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.