How to Grant Permissions Only on the Replica in Database Mirroring and AlwaysOn AG
You work with Database Mirroring or AlwaysOn AG, and you want to make sure your end users work only on...
2016-03-03
306 reads
You work with Database Mirroring or AlwaysOn AG, and you want to make sure your end users work only on...
2016-03-03
306 reads
Happy 2016!
I continue my tradition of summarizing the things I learned in the past year (as a reminder, here’s what...
2016-01-25
658 reads
In the previous post, we talked about when you should use identity/sequence as a clustered index key and when it’s...
2016-01-19
1,341 reads
A few days ago, while delivering my session, The Data-Loading Performance Presentation, I was asked when, performance-wise, Identity should be...
2015-12-28 (first published: 2015-12-16)
3,819 reads
A few days ago I returned from PASS Summit 2015 (and a vacation I took afterwards). Here’s my recap: I...
2015-11-22
675 reads
I have just finished delivering my session, The Data Loading Performance Presentation at PASS Summit 2015. It went very well,...
2015-10-30
1,061 reads
Nolock is not the Satan, but no an angel too
Surfing the web you will find articles saying that Nolock is...
2015-10-26
481 reads
AlwaysOn Availability Groups is a great technology that centralizes the management of High Availability, Disaster Recovery and Scale-Out. However, in...
2015-09-24
1,326 reads
This weekend, I’ll hop on a plane and fly over to Norway for SQLSaturday Oslo.
I’ll be delivering a session I...
2015-08-26
763 reads
Last week, I gave a presentation about SQL Server’s data warehouse capabilities, and specifically about APS (Analytics Platform System) and...
2015-08-19
1,126 reads
It is Friday, the queries are running, and nobody is watching the bill. That...
By Steve Jones
Annabel retired from Redgate Software this week. Across most of my career at Redgate,...
By Tim Radney
As a SQL Server DBA with years of experience tuning production environments, I’ve seen...
Comments posted to this topic are about the item What is the Cloud?
Comments posted to this topic are about the item Changing the Schema
Comments posted to this topic are about the item Index Fragmentation Explained: Page Splits,...
I set up a few users on my SQL Server 2022 instance.
CREATE LOGIN User1 WITH PASSWORD = 'Demo12#1' CREATE USER User1 FOR LOGIN User1 GO CREATE LOGIN User2 WITH PASSWORD = 'Demo12#2' CREATE USER User2 FOR LOGIN User2 GO CREATE LOGIN User3 WITH PASSWORD = 'Demo12#3' CREATE USER User3 FOR LOGIN User3 GOI then created a schema that one of them owned. Under this schema, I added a table with some data.
CREATE SCHEMA MySchema AUTHORIZATION User1
GO
CREATE TABLE Myschema.MyTable(myid INT)
GO
INSERT MySchema.MyTable
(
myid
)
VALUES
(1), (2), (3)
GO
SELECT * FROM MySchema.MyTable
GO
I granted rights and verified that User2 could access this table.
GRANT SELECT ON Myschema.MyTable TO User2 GO SETUSER 'USER2' GO SELECT * FROM MySchema.MyTable GOThis worked. Now, I move this schema to a new user.
ALTER AUTHORIZATION ON SCHEMA::Myschema TO User3; GOWhat happens with this code?
SETUSER 'USER2' GO SELECT * FROM MySchema.MyTable GOSee possible answers