High Availability Lingo
You have got to love the way the SQL Server team change the lingo in all of their high availability...
2012-08-13
1,174 reads
You have got to love the way the SQL Server team change the lingo in all of their high availability...
2012-08-13
1,174 reads
Let me set the scene, one of our internal IT SQL Servers which stores a whole host of performance metrics...
2012-08-08
1,857 reads
Today I was asked for "a list of all tables in all databases" on a particular instance of SQL Server. ...
2012-06-13
889 reads
Today’s post is something I thought I would share as there is an awful lot of incorrect commands I have...
2012-04-02
847 reads
If you create a maintenance plan (SQL 9.0.3042) to backup databases and select All databases as below;
Then at some point...
2012-03-16
911 reads
In this modern age of technology DBA’s face an ever increasing demand from businesses; our databases must perform, be secure,...
2012-03-14
630 reads
Well that's it, my "A Script A Day" series is finished. I hope you found the scripts I provided useful, I've used...
2012-03-03
588 reads
Today’s script is one that I used earlier this week. On Thursday I migrated a server from SQL Server 200...
2012-03-02
539 reads
Today’s script is also one I used in my migration on Wednesday. It again uses string manipulation to generate a...
2012-03-02
537 reads
Today’s script is based on performance counters and in particular the sys.dm_performance_counters DMV. There are many ways in which to...
2012-02-29
2,348 reads
By Brian Kelley
I once kept a gratitude journal and I still have a task on my...
By Arun Sirpal
The goal is simple: register AgentDBA as an MCP server in Claude Code, so...
By Steve Jones
I was excited to try out the latest release of SSMS, v22.12.1 for this...
WhatsApp:0817781222 Jl. Bina Insani No. 7G-7H, RT.003/RW.09, Kedung Jaya, Tanah Sareal, Kota Bogor, Jawa...
WhatsApp:0817781222 Jl. Kapten Muslihat No. 15 A, RT.01/RW.01, Pabaton, Kecamatan Bogor Tengah, Kota Bogor,...
Hi everyone, We previously used the Microsoft Access Database Engine 2016 (ACE) provider. As...
I have a few tables in my SQL 2025 database:
CREATE TABLE [dbo].[Customer] ( [CustomerID] [int] NOT NULL, [CustomerName] [varchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [AddressKey] [int] NULL, [CustomerStatus] [int] NULL, [CustomerContact] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [ContactEmail] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [PreferredName] [char] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] GO ALTER TABLE [dbo].[Customer] ADD CONSTRAINT [CustomerPK] PRIMARY KEY CLUSTERED ([CustomerID]) ON [PRIMARY] GO CREATE TABLE [dbo].[Orders] ( [OrderID] [int] NOT NULL, [CustomerID] [int] NOT NULL, [ProductID] [int] NOT NULL, [OrderDate] [date] NOT NULL, [Quantity] [int] NOT NULL ) ON [PRIMARY] GO ALTER TABLE [dbo].[Orders] ADD CONSTRAINT [PK__Orders__C3905BAFE0146D59] PRIMARY KEY CLUSTERED ([OrderID]) ON [PRIMARY] GO ALTER TABLE [dbo].[Orders] ADD CONSTRAINT [FK_Orders_Customers] FOREIGN KEY ([CustomerID]) REFERENCES [dbo].[Customers] ([CustomerID]) GO ALTER TABLE [dbo].[Orders] ADD CONSTRAINT [FK_Orders_Products] FOREIGN KEY ([ProductID]) REFERENCES [dbo].[Products] ([ProductID]) GO CREATE TABLE dbo.CustomerReturn ( EntryID INT NOT NULL CONSTRAINT CustomerReturnPK PRIMARY KEY , CustomerID INT , ReturnDate DATETIME , OrderID INT NOT NULL ) GOThere are multiple rows in all these tables. I am trying to find how many customers have never returned anything, and I run this:
SELECT count(*)
FROM dbo.Customer
WHERE CustomerID NOT IN
(
SELECT CustomerID FROM dbo.CustomerReturn
);
I get zero rows, but I know there are customers who have not returned anything. What is wrong? See possible answers