Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
darrellbutler
Creator
Creator

Generate a Unique Value to replace null

Hi,

I have a table that contains null values, I need to populate this field with a random number in order for it to fit into my link table.

Can anybody recommend the best loop approach to do this, my table does contain a min and max order number that I could use to control the loop.

Rgds

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Something like this maybe:

Table1:

Load

      FieldA

     ,FieldB

     ,FieldC

     ,if(len(trim(MyField))=0, autonumber(rand()),MyField) as MyField

From ...somesource...;


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Gysbert_Wassenaar

Something like this maybe:

Table1:

Load

      FieldA

     ,FieldB

     ,FieldC

     ,if(len(trim(MyField))=0, autonumber(rand()),MyField) as MyField

From ...somesource...;


talk is cheap, supply exceeds demand
Not applicable

Hi,

Try autonumber() or RecNo() or RowNo() Functions...

Or

http://adeilson.com.br/2010/02/23/script-para-gerar-numero-randomico-no-sql-server/

Rebeca

darrellbutler
Creator
Creator
Author

Thanks guys, is there anyway you can dictate the starting number in an autonumber command, for example I might not want it to start at 1.

Rgds

Darrell