dbaspot
Tags Register FAQ Calendar Search Today's Posts Mark Forums Read

Users & Roles on home development machine VS work environment - ms-sqlserver

This is a discussion on Users & Roles on home development machine VS work environment - ms-sqlserver ; I have a question that I will try to pose as best I can. While working at home, and obviously not having the AD from our work environment... I am constantly updating the mappings to domain users after I push ...


Home > Database Forum > Microsoft SQL Server > ms-sqlserver > Users & Roles on home development machine VS work environment

Reply

 

LinkBack Thread Tools Display Modes
  #1  
Old 09-09-2009, 10:12 PM
usenet
Guest
 
Posts: n/a
Default Users & Roles on home development machine VS work environment

I have a question that I will try to pose as best I can.

While working at home, and obviously not having the AD from our work
environment...

I am constantly updating the mappings to domain users after I push a new
..mdf file up
to our development machine from home.

I am currently building a new application that will replace an existing one.
The new app uses a SQL2005 backend.

When I push a new version of the .mdf file to our work development machine,
I need to remap the existing users to the DB and then
add them to the roles they need to be in. I know there has to be a better
way.

Hopefully this is clear enough to convey my situation and question.
Any help is very much appreciated.
tia,
...bob

Reply With Quote
  #2  
Old 09-10-2009, 01:41 AM
usenet
Guest
 
Posts: n/a
Default Re: Users & Roles on home development machine VS work environment

Bob
To remap you can use the following
ALTER USER uname WITH LOGIN = loginanme

For roles, you will to script out all users before applying a new database

select [Role] = r.name, [Member] = m.name
from sys.database_role_members rm
join sys.database_principals r on rm.role_principal_id = r.principal_id
join sys.database_principals m on
rm.member_principal_id = m.principal_id
order by r.name, m.name



"Bob" wrote in message
news:F99D2BD5-49AA-454A-B72D-3BA1CB5A6708@microsoft.com...
>I have a question that I will try to pose as best I can.
>
> While working at home, and obviously not having the AD from our work
> environment...
>
> I am constantly updating the mappings to domain users after I push a new
> .mdf file up
> to our development machine from home.
>
> I am currently building a new application that will replace an existing
> one.
> The new app uses a SQL2005 backend.
>
> When I push a new version of the .mdf file to our work development
> machine,
> I need to remap the existing users to the DB and then
> add them to the roles they need to be in. I know there has to be a better
> way.
>
> Hopefully this is clear enough to convey my situation and question.
> Any help is very much appreciated.
> tia,
> ..bob
>



Reply With Quote
  #3  
Old 09-10-2009, 10:06 AM
usenet
Guest
 
Posts: n/a
Default Re: Users & Roles on home development machine VS work environment

Thanks Uri,
This looks like just what I need.
I appreciate the reply.

"Uri Dimant" wrote in message
news:eDwXwkdMKHA.1312@TK2MSFTNGP05.phx.gbl...
> Bob
> To remap you can use the following
> ALTER USER uname WITH LOGIN = loginanme
>
> For roles, you will to script out all users before applying a new
> database
>
> select [Role] = r.name, [Member] = m.name
> from sys.database_role_members rm
> join sys.database_principals r on rm.role_principal_id =
> r.principal_id
> join sys.database_principals m on
> rm.member_principal_id = m.principal_id
> order by r.name, m.name
>
>
>
> "Bob" wrote in message
> news:F99D2BD5-49AA-454A-B72D-3BA1CB5A6708@microsoft.com...
>>I have a question that I will try to pose as best I can.
>>
>> While working at home, and obviously not having the AD from our work
>> environment...
>>
>> I am constantly updating the mappings to domain users after I push a new
>> .mdf file up
>> to our development machine from home.
>>
>> I am currently building a new application that will replace an existing
>> one.
>> The new app uses a SQL2005 backend.
>>
>> When I push a new version of the .mdf file to our work development
>> machine,
>> I need to remap the existing users to the DB and then
>> add them to the roles they need to be in. I know there has to be a
>> better way.
>>
>> Hopefully this is clear enough to convey my situation and question.
>> Any help is very much appreciated.
>> tia,
>> ..bob
>>

>
>


Reply With Quote
Reply

Thread Tools
Display Modes



All times are GMT -4. The time now is 03:47 PM.