Add random string to a field using SQL Update
Here’s a simple script to add a random string to a SQL Update: update <dbname>set <field> = (SELECT SUBSTRING(CONVERT(VARCHAR(40), NEWID()),0,9)) This will update each row with a distinct 8 alphanumeric characters, e.g. C2552926 Breaking this down in terms of functionality: NEWID() – generates a UUID VARCHAR(40) – tells CONVERT() what string data type, max len… Continue reading Add random string to a field using SQL Update