Sending Job Failed Information Through E-Mail Using T-SQL
Sending Job Failed Information Through E-Mail Using T-SQL.
2012-03-06 (first published: 2012-02-13)
2,326 reads
Sending Job Failed Information Through E-Mail Using T-SQL.
2012-03-06 (first published: 2012-02-13)
2,326 reads
TSQL code that generates numbers (tally table) from 1 to N without using any tables
2012-03-01 (first published: 2012-02-21)
1,809 reads
A function that emulates SET DATEFIRST 6 within a function for finding relevant date information.
2012-02-29 (first published: 2012-02-15)
535 reads
This script will show the currently running queries in the system. It will give the entire script which is involved in the background.
2012-02-28 (first published: 2012-02-01)
1,416 reads
This query shows how to write a T-SQL statement that lists all numbers between 1 and 100 ordered, without use of any DATABASE table with only ONE select statement.
2012-02-20 (first published: 2011-12-31)
2,275 reads
Create a c:\servers.txt list of servers. No spaces or it wont work. Then copy the code into a ps1 file and edit the directroyfilename to show where you want the files to end up.
2012-02-17 (first published: 2012-01-23)
1,870 reads
Find drive, freespace, usedspace and percent free for all drives and mounted volumes.
2012-02-16 (first published: 2011-12-15)
821 reads
3 functions that implement the left (<<), right (>>) and unsigned right (>>>) shift operators, commonly found in C-style languages.
2012-02-15 (first published: 2011-12-30)
8,123 reads
Output table of gaps in a primary key across multiple databases on same, remote and/or linked servers.
2012-02-13 (first published: 2011-08-12)
949 reads
2012-02-13 (first published: 2011-12-30)
1,714 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 SQL Art, Part 4: Happy...
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?
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