SQL Server – Script to generate Read-Only Routing URLs
If you are familiar with the new feature Read-Only Routing introduced in SQL Server 2012 with AlwaysOn then you should...
2015-10-01
521 reads
If you are familiar with the new feature Read-Only Routing introduced in SQL Server 2012 with AlwaysOn then you should...
2015-10-01
521 reads
With the release of Microsoft SQL Server 2014, we have the first version of SQL Server that supports encrypting database...
2015-07-21
695 reads
DBAs most often face scenarios where they need to capture graphical execution plan of a query currently running on a live production instance because...
2015-06-05
1,117 reads
Recently I came across a situation where queries are loading extremely slow from a table. After careful analysis we found...
2015-06-04
717 reads
Most people prefer to have “sa” account as the database owner, primary reason being sa login cannot be removed/deleted unlike any...
2015-05-05
403 reads
According to MSDN: If the SQL Server service is running as a built-in account, such as Local System, Local Service,...
2015-02-06
650 reads
Most of us know the default port for SQL Server is 1433, but there are various ports being used by SQL Server...
2014-12-07
385 reads
I have been noticing one very common error that occurs while trying to failover an Availability Group in SQL Server 2012 AlwaysON...
2014-10-28
2,009 reads
Last week on one of our production servers (version 2011.110.3373.0), we’ve encountered a strange issue which is relatively new (only...
2014-08-12
608 reads
An auto-growth event is the process by which the SQL Server engine expands the size of a database file when...
2014-06-25
1,113 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...
Hi everyone, We previously used the Microsoft Access Database Engine 2016 (ACE) provider. As...
Hello, We recently migrated a database from SQL Server 2014 to SQL Server 2022....
Comments posted to this topic are about the item Detecting Outliers in Power BI...
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