jeudi 18 novembre 2021

Mssql - generate random numeric string 27 characters long

I need to insert random data in my database for testing, and would need to generate a numeric string (can start with 0) 27 characters long.

I've been looking into NEWID() but it contains also letters, same for NEWSEQUENTIALID().

so far my aproach would be to make a while loop, generate each digit randomly and concatenate it, but it seems a very slow aproach.




Aucun commentaire:

Enregistrer un commentaire