PowerShell Basics
Powershell. I have seen the word but what is it? This article gives you a basic introduction to what PowerShell is and how you might use it.
2013-02-22 (first published: 2011-01-24)
25,052 reads
Powershell. I have seen the word but what is it? This article gives you a basic introduction to what PowerShell is and how you might use it.
2013-02-22 (first published: 2011-01-24)
25,052 reads
PASS is launching a new PowerShell Virtual Chapter. It's first meeting is next Wednesday at 12 pm EDT.
2010-10-15
849 reads
It was a year ago that Microsoft shipped PowerShell 2. Jonathan Medd lists the top ten reasons why PowerShell 2 should be an important tool for your work
2010-10-01
4,489 reads
Using Powershell with SMO, learn to alter or move indexes easily in this new article from Zach Mattson.
2010-09-30
4,617 reads
Inspired to streamline the process of gathering and storing data from Performance Monitor Counters, SQL Server MVP Laerte Junior guides us through the functions of his remarkably useful module.
2010-07-21
3,220 reads
To learn PowerShell, Laerte Junior suggests that you just start using it. To encourage you to start, he provides a series of tips on using PowerShell with SQL Server to solve various everyday problems. With a little patience, a good IDE, and a bit of help and advice, "the lion is dead".
2010-06-24
5,883 reads
Windows PowerShell v2 introduces self-contained “modules,” making it easier to share scripts with reusable functions, custom format views or type extensions.
2010-05-28
2,789 reads
In a previous tip on creating a Function to Return Default SQL Server Backup Folder , you've seen how you can create a T-SQL function to query the registry and retrieve the default SQL Server Backup folder. Is there an easier way to do it in Windows PowerShell?
2010-04-23
2,763 reads
In this final look into his everyday essentials, Laerte Junior provides some useful scripts for the DBA that use an alternative way of error-logging. He shows how to use a PowerShell script to check and, if necessary, to defragment your indexes, write data to a SQL Server table, and change the collation for a table. Being an exceptional DBA just got a little easier.
2010-02-26
2,552 reads
Laerte Junior takes us further into the world of an Exceptional PowerShell DBA, showing us how he uses PowerShell 2.0 to take all the headaches out of even more of his daily checklist. What could be better than having your morning checklist run itself?
2010-01-28
3,012 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