TSQL to Map User to Database

前端 未结 6 1662
刺人心
刺人心 2020-12-08 09:43

So I\'m not able to user enterprise manager to do this... If I was I wouldn\'t even be asking this question. So I\'m wondering if there is a way through TSQL to execute a co

6条回答
  •  旧时难觅i
    2020-12-08 09:43

    Change default database of a login:

    alter login  with default_database = ;
    

    Create a user in a database for a given login:

    use ;
    create user  from login ;
    

    Make an user member of db_owner group:

    use 
    exec sp_addrolemember 'db_owner', '';
    

    Make a login 'dbo' of a database:

    alter authorization on database:: to ;
    

提交回复
热议问题