Pull User / Server Data Info..

  • Okay, I have a few questions that I am really unsure of....

    First, is it possible to grab BOTH the domain which the SQL Server is located and the name of the SQL Server from a internal table or PROC? Meaning, if I want to know what domain a particular SQL Server risides and and the name of the server, how can that be pulled..?

    Also, is is possible to grab permission from a table/view rather than a SP..? I know I can look sp_helprolemember, then to Helprotect. But, I'm curious if it is possble to view it similar to Oracle (dba_sys_privs, dba_tab_privs)

    Thanks in advanced!

  • Look under Security Catalog Views in BOL for your second question. sys.database_role_members is one such view.

  • That view did not give me really the information I was looking for...

    Also, any know of my first two Q's?

    Thanks Again

    Topher.

  • if your sql server is not clustered, for the computer name you can use

    select serverproperty('MachineName')

    otherwise use select serverproperty('ComputerNamePhysicalNetBIOS') - see BOL, serverproperty function for details

  • How about Domain? 🙂 ?? We easily have 10+ domains and for scripting purposes, this infomation needs to be pulled for reporting. Hopefuly it is as simple as pulling the servername!!!

    -Topher

  • try getting the info from the windows registry

    something like:

    EXEC xp_regread 'HKEY_LOCAL_MACHINE',

    'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon',

    'DefaultDomainName'

    i hope you have the rights to read the key 🙂

    if you get 'access denied', pls see this http://support.microsoft.com/kb/887165

    that applies to sql2000 with sp4

  • I recieve an error.....

    RegOpenKeyEx() returned error 2, 'The system cannot find the file specified.'

    Msg 22001, Level 1, State 1

  • i have typed extra characters in the key, please try again as i have corrected it

    still, please be notified that i have not tested this query 🙂

Viewing 8 posts - 1 through 7 (of 7 total)

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