Re: Give more than one SQL user permissions to a DB



Are you asking for a script so that you don't have to click away using the
GUI? Perhaps the following will get you started. If you have a list of the
accounts in a SQL table (or syslogins), you can generate the script using a
SQL query.

USE MyDatabase
--add login (if necessary)
EXEC sp_grantlogin 'MyDomain\User1'
--specify default database (if desired)
EXEC sp_defaultdb 'MyDomain\User1', 'MyDatabase'
--add user to database
EXEC sp_grantdbaccess 'MyDomain\User1'

--
Hope this helps.

Dan Guzman
SQL Server MVP

<nospam@xxxxxxxxxxxxx> wrote in message
news:4vqg82pcidtghjujil89169t6a6t4l6nik@xxxxxxxxxx
We have over 200 SQL user accounts that need access to a DB. Because
of the way this software works they have to be individually created (I
would have preferred a group but can't do that with this software).
Anyway is there an easy way of give all 200 users access to this DB
without haveing to go to each account and selecting the DB?

Thanks


.



Relevant Pages

  • pls help for the script!
    ... my script do not run with the parameter " ... exec sp_executesql @sql ... --Dummy-Tabelle Spaltenname erstellen ...
    (microsoft.public.de.vb.datenbank)
  • Re: Vista hosting XPe tools/db
    ... Are you running this script on the machine that actually has the SQL server ... machine hosting the database. ... i don't know if you can install a second instance of SQL ...
    (microsoft.public.windowsxp.embedded)
  • Re: ActiveX script works in DTS but not in job, why?
    ... Account that SQL Agent runs under and it is a Local Admin on the box. ... As another test I saved the script as a .vbs file and tried running it, ... Microsoft OLE DB Provider for SQL Server ... that would be since I need to be able to load DTS packages from either a SQL ...
    (microsoft.public.sqlserver.dts)
  • Re: Enterprise Manager Newbie Question
    ... a SQL backup is not a simple copy of the database files. ... Is it possible to write a script that one could run from a workstation and ...
    (microsoft.public.sqlserver.tools)
  • Re: Vista hosting XPe tools/db
    ... here's an alternative script using the Microsoft ADO as ... opposed to the SQL DMO - this should allow this script to work ... Microsoft Windows XP Embedded Test Team ... This posting is provided "AS IS" with no warranties, and confers no rights. ...
    (microsoft.public.windowsxp.embedded)