How do I add multiple users to a role in one statement?
0
votes
2
answers
10925
views
I simply want to add multiple users that I have created to a created role then grant all privileges on said role. This is what I have thus far:
CREATE USER Bob FROM LOGIN Bob;
CREATE USER Billy FROM LOGIN Billy;
CREATE USER Bobby FROM LOGIN Bobby;
CREATE ROLE Users;
ALTER ROLE Users ADD MEMBER Bob;
GRANT ALL PRIVILEGES ON ABCdatabase.* TO Users;
I want to add Billy and Bobby, is there a way to add them to the ALTER line or do I have a create a statement for each members? Any improvements to the code above is helpful.
What kind of SQL server am I using? I am not necessarily using any specific type. I merely need to provide code for a school assignment and am not testing any of this on any particular system. Thanks in advance.
Asked by CrashFive
(13 rep)
Nov 7, 2016, 01:48 AM
Last activity: Nov 7, 2016, 05:10 AM
Last activity: Nov 7, 2016, 05:10 AM