skip to Main Content

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.

2

Answers


  1. 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

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

    The Built in GUID will give you alphanumeric id, There in No proper way to generate the Integer value with specific length.

    The Work around you can try is You can concat two rand() functions output with 10 digits each between 1,000,000,000 and 9,999,999,999 to make 20-digit lengths value (It will give you the numeric value with string type).

    @Concat(string(rand(1000000000,9999999999)),string(rand(1000000000,9999999999)))
    

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search