SQL Update help needed

Soldato
Joined
29 Aug 2006
Posts
4,283
Location
In a world of my own
This is one for the dbo's out there...

I have an MSSQL database with a table in it dbo.useraccounts that has a field 'name' that is current populated with real users names. I need to anonymise all these entries into 'DOMAIN\User1', 'DOMAIN\User2', etc

Does anyone know a bit of sql I can run to achieve this?

Many thanks!

:cool:
 
Does the table have an id field?

If so you could do something like this:

Code:
UPDATE dbo.useraccounts
  SET useraccounts.name = CONCAT('DOMAIN\User', useraccounts.id)

Note, this is MySQL Syntax, MSSQL may be different.
 
Thankyou for your help guys - this statement did the trick:

update Anonymous.dbo.useraccounts
set name = 'DOMAIN\User' + cast(useraccounts.id as varchar(3))

Again - many thanks!

:D
 
Back
Top Bottom