rsram312
rsram312

Reputation: 141

Azure data factory - Generate custom Guid and copy to SQL table

I need to generate a unique Guid which contains only numeric and of length 20, for every row in the table.

Currently, I am running one lookup activity (name - FetchIDs) to run the Stored procedure. Output of the lookup activity is as shown below

 {
   “count”: 2,
   “value”: [
      {
        “name”: “Test”,
        “ID”: 12345,
        “City”: “City A”,
        “State”: “State A”
      },
      {
        “name”: “Test2”,
        “ID”: 23456,
        “City”: “City B”,
        “State”: “State B”
      }
    ]
 }

Above lookup output might have N number of rows. I would need to add a logic to create a unique custom Guid for each row in above field and then copy this over to another SQL table (named - OutputTable)

I tried using inbuilt guid(‘N’) to generate the unique GUID. However; it was alphanumeric. I wanted to create a unique numerical GuID Of length 20 for each row, before copying it over to the SQL table.

Tried a few options. But, have not been able to come up with the way which can solve it.

Upvotes: 0

Views: 167

Answers (1)

Nandan
Nandan

Reputation: 4945

As your ask is generating only numeric codes, you cannot use uuid() function in dataflow; you can use random function in mapping dataflow.But it would generate 16 length numeric character so you can concatenate 2 random numerics to create a 20 length variant.

Also you can use rand function directly in SQL database itself as default column value

Upvotes: 0

Related Questions