-
Jun 18th, 2021, 05:45 PM
#1
[RESOLVED] Problem Adding User to Role
In SQL Server Express something (I forget which version, but something fairly recent, like 2017, if that's possible), I'm trying to write a script to add users and assign some roles to them. Adding the user is working, but then I attempt to assign a role using this:
ALTER ROLE db_datareader ADD MEMBER HISAppLogin
Which appears to be right according to a variety of sites, yet I'm getting an error on the ADD, with the error message saying that WITH is expected. The line is taken straight from the MS documentation, and is confirmed on a variety of other sites, so I'm not sure what I am doing wrong. I can see that WITH is an option, but it's an option for doing something that doesn't seem right. So...what am I doing wrong?
My usual boring signature: Nothing
-
Jun 18th, 2021, 05:54 PM
#2
Re: [RESOLVED] Problem Adding User to Role
Well, nevermind. Turns out, I was connecting to the wrong database. I was connecting to a 2008/R2 instance that probably got installed along with VS2010, or something like that. The ALTER ROLE statement doesn't work that far back, and a stored procedure must be used, instead. Since I was on the wrong SQL Server instance, it wasn't running, and that might have been a good thing.
My usual boring signature: Nothing
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|