Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- declare @consonantName varchar(42);
- declare @vowelName varchar(42);
- with vowels as (
- select
- *
- from (
- values
- ('a'),('e'),('i'),('o'),('u'),('y'),
- (null)
- ) v (vowel)
- ),
- consonants as (
- select
- *
- from (
- values
- ('b'),('c'),('d'),('f'),('g'),('h'),
- ('j'),('k'),('l'),('m'),('n'),('p'),
- ('q'),('r'),('s'),('t'),('v'),('w'),
- ('x'),('z'),
- (null)
- ) c (consonant)
- ),
- names as (
- select
- upper(isnull((select top 1 consonant from consonants where consonant is not null order by newid()), '')) +
- isnull((select top 1 vowel from vowels order by newid()), '') +
- isnull((select top 1 consonant from consonants order by newid()), '') +
- isnull((select top 1 vowel from vowels order by newid()), '') +
- isnull((select top 1 consonant from consonants order by newid()), '') +
- isnull((select top 1 vowel from vowels order by newid()), '') +
- isnull((select top 1 consonant from consonants order by newid()), '') +
- isnull((select top 1 vowel from vowels order by newid()), '') +
- isnull((select top 1 consonant from consonants order by newid()), '') +
- isnull((select top 1 vowel from vowels order by newid()), '') +
- isnull((select top 1 consonant from consonants order by newid()), '') +
- isnull((select top 1 vowel from vowels order by newid()), '') +
- isnull((select top 1 consonant from consonants order by newid()), '') +
- isnull((select top 1 vowel from vowels order by newid()), '') as consonantName,
- upper(isnull((select top 1 vowel from vowels where vowel is not null order by newid()), '')) +
- isnull((select top 1 consonant from consonants order by newid()), '') +
- isnull((select top 1 vowel from vowels order by newid()), '') +
- isnull((select top 1 consonant from consonants order by newid()), '') +
- isnull((select top 1 vowel from vowels order by newid()), '') +
- isnull((select top 1 consonant from consonants order by newid()), '') +
- isnull((select top 1 vowel from vowels order by newid()), '') +
- isnull((select top 1 consonant from consonants order by newid()), '') +
- isnull((select top 1 vowel from vowels order by newid()), '') +
- isnull((select top 1 consonant from consonants order by newid()), '') +
- isnull((select top 1 vowel from vowels order by newid()), '') +
- isnull((select top 1 consonant from consonants order by newid()), '') +
- isnull((select top 1 vowel from vowels order by newid()), '') +
- isnull((select top 1 consonant from consonants order by newid()), '') as vowelName
- )
- select
- @consonantName = (select top 1 consonantName from names),
- @vowelName = (select top 1 vowelName from names)
- select
- case
- when rand(checksum(newid())) > 0.5
- then left(@consonantName, 2 + rand(checksum(newid())) * 12)
- else left(@vowelName, 2 + rand(checksum(newid())) * 12)
- end as [name]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement