How to put first 4000 symbols from string to field?

Sergey Ufimtsev 1 Reputation point

Hello! I have a table in azure sql with field type nvarchar(4000) and i am getting data from api with copy command and some times data from api has more than 4000 symbols and i want to store first 4000 symbols or default value "data too long".

How can i achieve this?

Azure SQL Database
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
7,174 questions
{count} votes

1 answer

Sort by: Most helpful
  1. HimanshuSinha-msft 19,196 Reputation points Microsoft Employee

    Hello @Sergey Ufimtsev ,
    Thanks for the ask and using the Microsoft Q&A platform .
    Have you tried the option of "allow data truncation " under mapping ? I am adding snaphot below .


    Please do let me know how it goes .
    Please do consider to click on "Accept Answer" and "Up-vote" on the post that helps you, as it can be beneficial to other community members