# Random 64 Characters alphanumeric String

• Eirikur Eiriksson

SSC Guru

Points: 182410

😎

• Jeff Moden

SSC Guru

Points: 995643

Eirikur Eiriksson (11/9/2016)

😎

Nah... just ran into the post. Just went through this in the company I work for, though. Base 26 and Base 36 numberings systems have more bad words than I do and I was in the U.S. Navy for more than 8 years. 😉

--Jeff Moden

RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
________Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
"If you think its expensive to hire a professional to do the job, wait until you hire an amateur."--Red Adair
"Change is inevitable... change for the better is not."

How to post code problems
How to Post Performance Problems
Create a Tally Function (fnTally)

• Mike Hinds

SSCarpal Tunnel

Points: 4258

Really nice solution, Lynn!

• ChrisM@Work

SSC Guru

Points: 186078

Dunno how I landed here, but...here's how I'd do it in current versions (this doesn't work with '2005):

SELECT CONVERT(CHAR(64),HASHBYTES('SHA2_512',CAST(NEWID() AS VARCHAR(36))),2)

[font="Arial"]“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw[/font]

Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
[url

• Eirikur Eiriksson

SSC Guru

Points: 182410

For fun, a variation of Chris's solution
😎

`DECLARE @BINID VARBINARY(16) = NEWID();;WITH BINARY_STUFF(DHASH,BINDATA,BINID)AS(  SELECT CONVERT(CHAR(64),HASHBYTES('SHA2_512',CONVERT(VARCHAR(36),@BINID,0)),2),CONVERT(VARCHAR(36),@BINID,0),@BINID UNION ALL  SELECT CONVERT(CHAR(64),HASHBYTES('SHA2_512',CONVERT(VARCHAR(36),@BINID,1)),2),CONVERT(VARCHAR(36),@BINID,1),@BINID UNION ALL  SELECT CONVERT(CHAR(64),HASHBYTES('SHA2_512',CONVERT(VARCHAR(36),@BINID,2)),2),CONVERT(VARCHAR(36),@BINID,2),@BINID )SELECT  BS.DHASH ,BS.BINDATA ,BS.BINIDFROM  BINARY_STUFF  BS;`

``` ```

Sample output

``` DHASH                                                            BINDATA                              BINID---------------------------------------------------------------- ------------------------------------ ----------------------------------AF9BD5FDA0A507E82823FBFADEC8F9991C3E47E7FC927236653D1A3D9F3DC846 ‰ƒÎâ‰zÝE˜ƒtˆd¶üÍ                      0x8983CEE2897ADD459883748864B6FCCD8AF91B54BB28E29AA2E0EC9897CD93F20C6FF42BB249F0B34915085DF773516C 0x8983CEE2897ADD459883748864B6FCCD   0x8983CEE2897ADD459883748864B6FCCD25F9F7297DA8123DCFDB9A81D5AFCD0EF46217A4FA787D42E6AC32F744397BEE 8983CEE2897ADD459883748864B6FCCD     0x8983CEE2897ADD459883748864B6FCCD ```

Viewing 5 posts - 16 through 20 (of 20 total)