Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8670317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:40:57+00:00 2026-06-12T18:40:57+00:00

Based on Martin Smith’s answer here , I’ve been trying to use a very

  • 0

Based on Martin Smith’s answer here, I’ve been trying to use a very similar technique to creating 10000 random strings that start with two characters(A-Z), then two numbers(0-9) and then two characters(A-Z). Anybody know how to do this using the same technique or is it not possible, Thanks in advance
Paul

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T18:40:58+00:00Added an answer on June 12, 2026 at 6:40 pm

    Slight modification to the original:

    DECLARE @Numbers  TABLE
    (
    n INT PRIMARY KEY
    );
    
    
    WITH E00(N) AS (SELECT 1 UNION ALL SELECT 1),   --2
            E02(N) AS (SELECT 1 FROM E00 a, E00 b), --4
            E04(N) AS (SELECT 1 FROM E02 a, E02 b), --16
            E08(N) AS (SELECT 1 FROM E04 a, E04 b), --256
            E16(N) AS (SELECT 1 FROM E08 a, E08 b)  --65,536
    INSERT INTO @Numbers
    SELECT TOP 1000 ROW_NUMBER() OVER (ORDER BY (SELECT 0))
    FROM E16
    
    /* 
     1.  Build a table variable of numbers
     2.  For each row in the table (up to row 1000)
     3.  Get the top 2 numbers from the table variable
     4.  For each number, get the absolute value of the checksum of a GUID
     5.  This value will always be a positive integer
     6.  Get the remainder of that integer when divided by 26
     7.  This will always be a number between 0 and 25
     8.  If the absolute value number is divisible by 2, add 65 to the number (uppercase)
     9.  Otherwise, add 97 to the number (lowercase)
     10. Use that number as an ASCII value and get the character representation
     11. Use FOR XML PATH to convert the two characters in the subquery to a string
     12. Repeat the same logic for 2 numbers (use %9 to get two numbers between 0 and 9) 
     13. Repeat the same logic from previous steps to get two more alphabetic characters
    */
    
    SELECT CAST((SELECT TOP 2 CHAR(CASE
                                      WHEN Abs(Checksum(Newid()))%2 = 0 THEN 65
                                      ELSE 97
                                    END + Abs(Checksum(Newid()))%26)
                 FROM   @Numbers n1
                 WHERE  n1.n >= -n2.n 
                 FOR XML PATH('')) AS CHAR(2)) + 
           CAST((SELECT TOP 2 Abs(Checksum(Newid()))%9
                 FROM   @Numbers n1
                 WHERE  n1.n >= -n2.n 
                 FOR XML PATH('')) AS CHAR(2)) +             
           CAST((SELECT TOP 2 CHAR(CASE
                                      WHEN Abs(Checksum(Newid()))%2 = 0 THEN 65
                                      ELSE 97
                                    END + Abs(Checksum(Newid()))%26)
                 FROM   @Numbers n1
                 WHERE  n1.n >= -n2.n /*So it gets re-evaluated for each row!*/
                 FOR XML PATH('')) AS CHAR(2))
    FROM   @Numbers n2  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make multilevel menu based on twitter bootstrap. http://jsfiddle.net/W3Zj8/ Here is the
Based on how things are done for my company, we issue updates very very
Based on an answer from a candidate I have a confusion regarding the functioning
Based on the answer for this question What's the difference between CompositionBatch and catalogs?
I'm trying to search for people based on their skills by using different keywords.
I can use Eric Martin's simplemodal somewhat. But I would like to call it
Edit: Updating post based on Martins comments below Hello, I'm just trying to get
Based on another question I posted on here, I was able to get the
I would like to use smart card based authentication on the Django development server,
Here is my code for css div based layout. I want a search box

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.