How to Update Caché User Full Name field via SQL?

Does anyone have any sample code for updating Caché users (and specifically Full Name and Comments) via SQL?  

Bonus points for knowing specifically what security resource needs to be assigned to allow someone to run the SQL.

Thanks in Advance!

Ben

  • + 1
  • 0
  • 167
  • 7
  • 2

Answers

Hi.

Use this code in namespace %sys:

update Security.Users set FullName =  'GOKU', Comment= 'Oi eu sou o GOKU' where id = 'gsjunior'

where the ID is the user login

Thank you Gilberto!

Any idea what resource is required to do this?   Is it just granting UPDATE rights on the Security.Users table?  Or is there a DB Role (limited - not %All or something crazy like that) which will allow this to be run?

Ben

Hi Benjamin.

What is your need?

Are you implementing a tool for this?

This is for an exercise I'm creating for updating users via SQL.  It is for educational purposes only and isn't going to be anything used in production

ok just be careful with this table so do not kill all users.

I recommend a backup of the file \ mgr \ CACHE.DAT responsible for storing users in Caché

Agreed - this could be very dangerous if not used carefully.  Fortunately in my case it's a training VM where all users are created programmatically :)

Do you have any idea on the minimum privileges required to select or update the Security.User table?

Thanks again for your help!

I did not find the feature however I was able to do this by giving permission for updatena table Security.Users through the SQL Tables tab.

If you want to do this for a group you can create a Resource custon and release it.

thank you for the time you took to look!  I thought that UPDATE SQL rights might be sufficient.

Thanks again and have a great night!

While Gilberto's answer is right, I would file this under "not the purpose of SQL".   While there are many things you can do with SQL, the purpose of SQL is not to administer Caché/IRIS users.  You are much better off using the Management Portal or one of the accepted APIs.