To "attempt" to guarantee uniqueness you could try hashing, but it's one way only and you might get clashes.
On Tue, 14 Mar 2023, 9:55 am Tom P via ozdotnet, <ozdotnet@ozdotnet.com> wrote: > Hello > > I was hoping some of the SQL experts here could help with a problem I am > facing. Currently have covid too so perhaps I'm not thinking clearly... > > Long story short, is there a way in SQL Server to convert > strings (varchars) of any length to exactly 32, keeping uniqueness? It > would also be nice if I could convert them back to ensure I haven't lost > information. > > Briefly, the reason I want to do this is my target is varchar(32) but the > IDs I am dealing with are made up of composite business keys of larger > length. I need to be able to use the current business keys and generate > unique 32 character equivalents in a deterministic way. > > Appreciate any advice. > > Thanks > Tom > -- > ozdotnet mailing list > To manage your subscription, access archives: https://codify.mailman3.com/