Can someone let me know how to add a cryptographic hash to a field in Azure Data Factory.
For example, I have an existing table and I would like to add additional column called 'Signature', and I would like to generate a 256 cryptographic hash for the 'Signature' column
I know it's easy to add a column to a table in the copy activity of ADF,see image below, but I don't know how to add a cryptographic hash value to the column
I have tried to modify my query to include a query that will apply the cryptographic hash, but I'm getting a Syntax error: Missing comma between arguments.
The original query is a follows:
@concat('SELECT * FROM ',pipeline().parameters.Domain,'.',pipeline().parameters.TableName)
The new query modifies the above query as follows:
@concat('SELECT *, HASHBYTES('SHA2_256', CAST(signature AS NVARCHAR(MAX))) AS Signature FROM ',pipeline().parameters.Domain,'.',pipeline().parameters.TableName)
However, I'm not sure where the missing commas need to be placed.
I think I fixed the query with the following:
@concat('SELECT *, HASHBYTES(SHA2_256, , CAST(signature AS NVARCHAR(MAX))) AS Signature FROM ',pipeline().parameters.Domain,'.',pipeline().parameters.TableName)
However, when I execute the copy activity I ge the following error:
Details Failure happened on 'Source' side. 'Type=Microsoft.Data.SqlClient.SqlException,Message=Incorrect syntax near ','.,Source=Framework Microsoft SqlClient Data Provider,'
I have modified the copy activity as follows, but still getting the same error
According to your image, you are using Azure SQL dataset as source in copy activity. Instead of creating Additional column you can use below query to create Signature column as you required:
@concat('SELECT *, HASHBYTES(''SHA2_256'', CAST( content AS NVARCHAR(MAX))) AS Signature FROM [', pipeline().parameters.schema, '].[', pipeline().parameters.tableName, ']')
It will generate value for signature column at sink as shown below: