Question: I've got a new varchar(10) field in a database with 1000+ records. I'd like to update the table so I can have random data in the field. I'm looking for a SQL solution.

I know I can use a cursor, but that seems inelegant.

MS-SQL 2000,BTW

Answer: 
Something like (untested code):

```
UPDATE yourtable
SET yourfield= CHAR(32+ROUND(RAND()*95,0));

```

Obviously, concatenate more random characters if you want up to ten chars.
It's possible that the query optimizer might set all fields to the same value; in that case, I would try

```
SET yourfield=LEFT(yourfield,0)+CHAR…

```

to trick the optimizer into recalculating each time the expression.
if you are in SQL Server you can use 

```
CAST(RAND() as varchar(10))

```

**EDIT**: This will only work inside an iteration. As part of a multi-row insert it will use the same RAND() result for each row.