Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Programming user mapping

Author  Topic 

harlingtonthewizard
Constraint Violating Yak Guru

352 Posts

Posted - 2008-11-17 : 19:30:49
How can I set the following through SQL programming?

I can do it manually through Management Studio by:

· Right click on Security > Logins > BUILTIN\Users and select properties.
· Select User Mapping.
· Under Users mapped to this login: select the check box for mydatabase.
· Under Database role membership for mydatabase: select the check box for db_datareader. (public is checked by default)

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2008-11-18 : 00:01:29
While doing this, at the end just click on "Script" button and you will get its script in query editor.
Go to Top of Page

harlingtonthewizard
Constraint Violating Yak Guru

352 Posts

Posted - 2008-11-18 : 00:24:10
Thanks but when I press the script button it puts up a dialog indicating 'There is no action to be scripted'.

quote:
Originally posted by lionofdezert

While doing this, at the end just click on "Script" button and you will get its script in query editor.

Go to Top of Page

harlingtonthewizard
Constraint Violating Yak Guru

352 Posts

Posted - 2008-11-18 : 00:36:54
OK, so I worked that one out, thanks:) You cannot just save a script you must make a change first and save individual changes one at a time. I then copied them into one script.
quote:
Originally posted by harlingtonthewizard

Thanks but when I press the script button it puts up a dialog indicating 'There is no action to be scripted'.

quote:
Originally posted by lionofdezert

While doing this, at the end just click on "Script" button and you will get its script in query editor.



Go to Top of Page
   

- Advertisement -