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 |
|
dmeagor
Starting Member
16 Posts |
Posted - 2010-06-06 : 14:34:18
|
| HiI need to select some records and reinsert/duplicate them again (not replace them) with a set of 8 digit random codes (a-z/A-Z/0-9) (not necessary to be unique.)This is what I am trying to do...INSERT INTO tblExample(fname,sname,email,code) SELECT fname,sname,email,generateCode() From tblExample WHERE id=12345Does anyone know how to do this? I've found several examples that generate a single code but I can't seem to put them into this query.David Meagor |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-06-06 : 16:32:10
|
You'll be fine if the function is a scalar function and returns one value per record. N 56°04'39.26"E 12°55'05.63" |
 |
|
|
naveengopinathasari
Yak Posting Veteran
60 Posts |
Posted - 2010-06-07 : 03:50:33
|
| Use Rand() function to generate numbersif you require alphabets to be genereated, convert the random number to char.Lets unLearn |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|