Determine Users with Permission on an Object
This script will walk the hierarchical chain of users and roles to find users with permissions on an object.
2009-03-24 (first published: 2009-02-18)
1,610 reads
This script will walk the hierarchical chain of users and roles to find users with permissions on an object.
2009-03-24 (first published: 2009-02-18)
1,610 reads
2009-03-23 (first published: 2009-02-17)
959 reads
2009-03-19 (first published: 2009-02-17)
1,445 reads
This code will drop all stored procedures made with splog. With minor modification it will also drop all functions and sp not made with splog.
2009-03-13 (first published: 2009-02-12)
1,037 reads
2009-03-11 (first published: 2009-02-13)
1,784 reads
2009-03-11 (first published: 2006-08-01)
792 reads
Dynamically creates a VB.NET class from parameters in a SQL Stored procedure.
2009-03-09 (first published: 2009-02-16)
1,054 reads
This script uses the system backup history to run a differential backup and place it in the directory of the last full backup.
2009-03-06 (first published: 2009-02-12)
642 reads
2009-03-04 (first published: 2009-02-16)
1,267 reads
This function will return the first, second, third, fourth or last day of a given month.
2009-03-03 (first published: 2009-02-10)
1,192 reads
By Arun Sirpal
Not every production incident is a database in RECOVERY_PENDING or a corrupted event (like...
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,...
Comments posted to this topic are about the item Extreme DAX: Take your Power...
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
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