SQL Server Logins

  • I have two servers (A & B). I restore the database (DB1) from server A to Server B every night. Server A has login account called rpt1 with read only access to DB1. After restore is done on B, I want change the permissions of rpt1 to read, write, create & drop temp tables and execute SP.

    Does anybody have the alter login/user script and willing to share?

    Thanks,

    KP

  • You can provide the user db_datawriter role to have the write privilege on user tables, for sp execution im not sure whether this works.

    Exec dbname.dbo.sp_addrolemember @rolename ='db_datawriter',

    @membername ='Username'

    You can also add the user to dbo role in the db, but the user have all the rights in the db.

    Exec dbname.dbo.sp_addrolemember @rolename ='db_owner',

    @membername ='Username'

  • No it didn't work... I think I have not asked it correctly.

    I have sql login (under security) account created. Now I need to add it as user to database DB1 as 'db_owner' using the script...

    Any idea?

  • Try to make use of sp_adduser stored procedure.

    Manu Jaidka

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

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