The Choices We Make
If you keep your head up and look around you’ll see the choices people make all the time. I saw...
2017-07-21 (first published: 2017-07-10)
1,974 reads
If you keep your head up and look around you’ll see the choices people make all the time. I saw...
2017-07-21 (first published: 2017-07-10)
1,974 reads
I want to take a moment to thank a few people for being amazing.
First up, Thomas LaRock is wrapping up...
2017-07-06
329 reads
I love Entity Framework. I also like (not love) nHibernate. That’s right, as a DBA and data professional, I’m telling...
2017-07-17 (first published: 2017-07-05)
2,777 reads
SQL Server provides multiple ways to perform most functions. In order to maximize your understanding of how SQL Server works...
2017-07-06 (first published: 2017-06-26)
2,000 reads
It’s worth noting that a lot of people will never need to create their own database. You may never create...
2017-06-20
492 reads
I just read several more horror stories that include, among other things, failed backups. I’ve said it before (at volume,...
2017-06-26 (first published: 2017-06-19)
1,823 reads
Thank you to everyone who participated in T-SQL Tuesday #091 which was on databases and DevOps. As I anticipated, this...
2017-06-23 (first published: 2017-06-15)
1,721 reads
The hardest part about implementing DevOps is not the tools you choose, but the processes you use to make DevOps...
2017-06-13
1,134 reads
The best way to learn any software is to start using it. There are a bunch of software tools in...
2017-06-12
1,104 reads
Implementing DevOps with databases presents a unique set of challenges. However, just because something might be hard doesn’t mean that...
2017-06-06
424 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...
Wa:0817781222 Jl. Otto Iskandardinata No.37, Karanganyar, Kec. Subang, Kabupaten Subang, Jawa Barat 41211
Wa:0817781222 Jl. Ir. H. Juanda No.118, Lebakgede, Kecamatan Coblong, Kota Bandung, Jawa Barat 40132
Wa:0817781222 Jl. Ahmad Yani No.9, RT.01/RW.05, Marga Jaya, Kec. Bekasi Sel., Kota Bks, Jawa...
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