Login

  • Hi All.

    I need to do a script that shows me the users on my sql server.

    I have come this far:

    select name,type_desc,create_date,modify_date,default_database_name

    from sys.server_principals

    where type in ('g','s')

    BUT what i now need is to know who created these users?

    Any assistance will be much appreciated.

  • who created the users is not saved anywhere...with a minor exception.

    SQL does not keep track of who created or modified anything...except for a short period in the default trace.

    the default trace keeps track of a short period of recent changes, and gets rolled over as space is needed to continuous tracking.

    once it's out of the default trace, it's gone and cannot be discovered.

    the easiest way is to use the built in report in the GUI, but chances are the data you seek has already been rolled over; if it's important in the future you will need to add your own DDL traces.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

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

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