2014-09-12 (first published: 2011-12-22)
3,315 reads
2014-09-12 (first published: 2011-12-22)
3,315 reads
Using Powershell to create color coded backup reports for all servers in your environment.
2011-12-19
14,109 reads
Why should any SQLserver administrator, DBA, or Developer be interested in Powershell? Johan Bijens presents a few reasons today.
2011-12-06
7,748 reads
At some point you are going to need a notification system for a range of events that occur in your servers. Laerte Junior shows how you can even set up temporary or permanent alerts for any WMI events to give you a system that fits your server environment perfectly.
2011-11-09
3,399 reads
How can I use PowerShell to do a Transaction Log backup for SQL Server databases? In this tip we look at an alternative way of creating transaction log backups using a PowerShell script.
2011-10-25
2,854 reads
If you're starting to learn PowerShell and want to see how you can use it for common DBA tasks, this tip will show you how to create a basic PowerShell script to backup all your user databases.
2011-09-30
3,589 reads
Laerte Junior was asked for a quick and easy way to save the output from the Get-EventLog cmdlet in a SQL Server table. Luckily, he already knew about Chad Miller's excellent Out-DataTable and Write-DataTable functions, and has laid out everything we need to use them like pros.
2011-09-19
2,003 reads
owerShell can be used to for many SQL administrative tasks; this tip walks through how to run T-SQL code and admin tasks on remote servers.
2011-09-13
3,153 reads
Sean Duffy recently had an unwelcome encounter with Exchange Server Back Pressure, which cut off his message flow due to a lack of space on the server. To make sure it didn’t happen again, he found a way to automatically monitor all his servers from afar, with a little PowerShell magic.
2011-09-12
5,092 reads
The purpose of this article is to demonstrate a custom scripting framework which enables the management of SQLServer databases from a Windows PowerShell session and also to extend Powershell’s flexibility by creating a set of commands customized to our needs.
2011-08-16
3,809 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