How to check a security account already exists in the database?

  • Hi,

    I am using sp_grantdbaccess to add a security account in a database. But if the account already exists, it will give an error: 'User or role 'VOIP' already exists in the current database'.

    >EXEC sp_grantdbaccess 'George', 'Georgie'

    Before calling 'sp_grantdbaccess' I want to check whether the account 'Georgie' already exists in the database.

    How can I do it?

    Thanks

    Unnic

  • you could run a query like this in the master db....

    select name, dbname, hasaccess from syslogins







    **ASCII stupid question, get a stupid ANSI !!!**

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

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