grant dbo permission on DB in T-SQL

  • hello, i am not a big expert in TSQL and i have following problem:

    we retrieve once a week a DB hosted at our provider to our sql server. Via FTP we get the db.bak, restore it and add a specific login to this DB. My problem is that this login must be DBO. And i dont knwo how to give this login the dbo permission with Tsql.

    Anyone an idea?

    thanks

  • 1. Grant those users access to the database

    use db1

    exec sp_grantdbaccess 'user1'

     

    2. Add those users to db_owner fixed database role

    use db1

    exec sp_addrolemember 'db_owner', 'user1'

     

  • thank tyou, it works and it was so easy. I am ashame.

     

     

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

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