Temporary exclusive database access
This simple script disconnects any other session that is connected to the specified database by temporarily switching the database to single user.
2015-11-20 (first published: 2015-10-25)
953 reads
This simple script disconnects any other session that is connected to the specified database by temporarily switching the database to single user.
2015-11-20 (first published: 2015-10-25)
953 reads
This script will drop a mail for sql drives if space on drives is below set threshold value. Log drives with 15 and data files drives with value of 10% as threshold value of free space.
2015-11-19 (first published: 2015-10-27)
2,720 reads
2015-11-18 (first published: 2015-10-29)
1,052 reads
Variables can be direct text or Expressions. It's handy to be able to get both at one pass. This little script does that.
2015-11-17 (first published: 2015-10-18)
2,177 reads
2015-11-13 (first published: 2015-10-19)
2,021 reads
This script is used to compress tables and indexes. It is designed for page compression on all. Just a little ditty to help with our EDW storage and processing.
2015-11-11 (first published: 2015-10-09)
1,333 reads
This scripts calculates the first day and the last day of a given week
2015-11-10 (first published: 2015-10-12)
1,177 reads
Get FirstDate and LastDate of Every month from two Dates.
Like IF we have @date1='05/02/2015' and @date2= '11/25/2015' then we will get list of first date and last date from month 5 to 11.
SELECT ID,FirstDate,LastDate,Month,Year FROM [GetFLDatelist](@date1,@date2)
2015-11-09 (first published: 2015-10-09)
1,285 reads
When you want gain exclusive access to database in order to restore database
2015-11-06 (first published: 2015-10-14)
1,955 reads
Rebuild index is expensive most time. So you don't rebuild all index blindly.
2015-11-04 (first published: 2015-10-05)
1,853 reads
By Steve Jones
Thanks to everyone that attended my sessions at VS Live San Diego yesterday. It...
By Steve Jones
I was creating a question on sp_readerrorlog and realized that this procedure is different...
By SQLPals
Why sys.fn_dblog Is Undocumented And Why It's Still There Why sys.fn_dblog...
Comments posted to this topic are about the item Implementing Type 4 Slowly Changing...
Comments posted to this topic are about the item The Disabled Index
Comments posted to this topic are about the item Server-Level Table sizes
I run this code on SQL Server 2022.
CREATE TABLE Drink
(
drinkid INT NOT NULL
CONSTRAINT DrinkPK PRIMARY KEY CLUSTERED,
drinkname VARCHAR(20),
rating NUMERIC(2, 1)
)
GO
INSERT INTO Drink
(
drinkid,
drinkname,
rating
)
VALUES
(1, 'Margarita', 4.5),
(2, 'Mojito', 4.3),
(3, 'Old Fashioned', 4.7),
(4, 'Martini', 4.4),
(5, 'Cosmopolitan', 4.2)
GO
ALTER INDEX drinkpk ON dbo.drink DISABLE
GO
SELECT * FROM dbo.Drink
GO
What is the result? See possible answers