Getting NT Authentication group name within SQL

  • I'm currently developing a security scheme for our database and one of the requirement is to filter the user transaction by only allowing a certain domain group to access the function.

    My question is, is there a function or a way where I can be able to get the domain group name of the current user through TSQL? A functinality like that of system_user or current_user.

     

    thanks.

  • you could use xp_logininfo, but imo you'd better use the security-capabilities of sqlserver.

    e.g. grant a nt-group as db-user and then grant it the needed (sp) rights.

    because then you avoid over-authorised situations with problems when you have a weak moment managing your security-procs.

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • Try this, I think this answers the second part of your question. SELECT 'The current user is: '+ convert(char(30), CURRENT_USER)

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply