T-SQL Tuesday #17 – APPLY Knowledge
It’s that time of the month again… again. Time for T-SQL Tuesday! This month’s event is being hosted by Matt...
2011-04-12
1,244 reads
It’s that time of the month again… again. Time for T-SQL Tuesday! This month’s event is being hosted by Matt...
2011-04-12
1,244 reads
Every career, whether on purpose or accident, is a journey from one job or project to another. To achieve great...
2011-04-11
577 reads
I’m going to SQL Rally! Are you going to SQL Rally? Have you heard of SQL Rally?
What’s SQL Rally?
I’m glad...
2011-04-07
423 reads
Use extended events; they work – and make you appear magical.
– “Write a SQL blog post in 11 words or less”...
2011-04-04
630 reads
We’ve seen a few summaries come through by now, so I’m going to throw mine into the mix. To recap...
2011-03-29
680 reads
Yesterday, I went in for my re-take of the MCM written exam. If you recall, I failed the exam last...
2011-03-29
574 reads
Previously, in a TSQL2sDay index summary post, I started a series on the DMV sys.dm_db_index_operational_stats. The series investigates how the...
2011-03-26
854 reads
Last week I spoke at the TechFuse event in Minnesota – out at Mystic Lake Casino. As I mentioned in the...
2011-03-24
481 reads
A couple weeks ago, I got some pretty great new. The book proposal that I had submitted to Apress was...
2011-03-22
635 reads
Twin Cities Code Camp will be hitting the University of Minnesota Campus again next month. This is a biannual event...
2011-03-18
587 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