Maden
Maden

Reputation: 11

Write string type json property to varbinary type Azure SQL column in Azure Data Factory

I have a requirement where I have a string type json value which I need to write to varbinary type column in Azure SQL db. No matter what I do, I get complained during copy activity that type doesn't match. The string value in JSON is already a hexadecimal, I'm just not sure how can I translate that to a varbinary type in copy activity.

Any help would be appreciated

I have tried changing the sink column type to Byte[] array, varbinary

Upvotes: 0

Views: 108

Answers (1)

Pratik Lad
Pratik Lad

Reputation: 8402

. To write a string type to SQL table you need to use lookup with the script activity to insert ta data.

  • Using lookup get the data from file or other location that need to be inserted. enter image description here
  • After that using script activity insert the data into SQL table by converting string to varbinary.
Insert into <table_name> values (1,Convert(varbinary(max),'@{activity('Lookup1').output.firstRow}'))

enter image description here

Upvotes: 0

Related Questions