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 |
|
Corobori
Posting Yak Master
105 Posts |
Posted - 2006-01-11 : 18:28:16
|
I have the code shown below in a VB code which I need to run in a Stored Procedure.This code needs to create a 6 digits code. I am looping to build the code either with a letter or number.Is it possible to "translate" it and use this in a SP ?Dim s(25) As Strings(1) = "A"s(2) = "B"s(3) = "C"s(4) = "D"s(5) = "E"s(6) = "F"s(7) = "G"s(8) = "H"s(9) = "J"s(10) = "K"s(11) = "L"s(12) = "M"s(13) = "N"s(14) = "P"s(15) = "Q"s(16) = "R"s(17) = "S"s(18) = "T"s(19) = "U"s(20) = "V"s(21) = "W"s(22) = "X"s(23) = "Y"s(24) = "Z"For j = 1 To 6 ' Build a 6 digit code Randomize() MyValue = Int((2 * Rnd()) + 1) ' Letter or number ? If MyValue = 1 Then ' Number Randomize() MyValue = Int((8 * Rnd()) + 1) sNumero = sNumero & MyValue Else ' Letter Randomize() MyValue = Int((24 * Rnd()) + 1) sNumero = sNumero & s(MyValue) End IfNext jean-lucwww.corobori.com |
|
|
nosepicker
Constraint Violating Yak Guru
366 Posts |
Posted - 2006-01-11 : 19:56:12
|
| See if you get any ideas from this thread:[url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=59194[/url] |
 |
|
|
Corobori
Posting Yak Master
105 Posts |
Posted - 2006-01-11 : 20:11:03
|
| Perfect, thanks !jean-lucwww.corobori.com |
 |
|
|
|
|
|