Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
hendrasd
Starting Member
20 Posts |
Posted - 2002-10-29 : 22:56:37
|
Is there any way or function in SQL Server 2000 to automatically generate a random character, with length 1 ?For example, a function that returns random character 'A','B' or 'C'.Thanks ...-- Never stop learning -- |
|
ashok
Yak Posting Veteran
57 Posts |
Posted - 2002-10-30 : 01:26:53
|
Try this :select char(cast((90 - 65 )*rand() + 65 as integer))65-90 is ascii character set range for A-Zseeding the rand() might be a good ideaquote: Is there any way or function in SQL Server 2000 to automatically generate a random character, with length 1 ?For example, a function that returns random character 'A','B' or 'C'.Thanks ...
-ashokhttp://www.unganisha.org |
|
|
leahsmart
Posting Yak Master
133 Posts |
Posted - 2004-06-30 : 07:58:30
|
I am trying to produce something along the same lines, I want to include the characters a-z and the numbers 0-9, how would I do this? |
|
|
mohdowais
Sheikh of Yak Knowledge
1456 Posts |
Posted - 2004-06-30 : 08:01:51
|
This should do it:SELECT LEFT(CAST(NEWID() AS VARCHAR(100)), 1) OS |
|
|
|
|
|