Hi smile,
Please take reference of the below test SQL query.
Database
For this query I have used of NorthWind database that you can download using the link given below.
Download Northwind Database
SQL
SELECT CASE
WHEN SUM(LEN(CompanyName)) > 25 THEN '25'
ELSE SUM(LEN(CompanyName))
END 'Length'
FROM Customers
WHERE Country = 'USA'
GO
SELECT CASE
WHEN SUM(LEN(CompanyName)) > 25 THEN '25'
ELSE SUM(LEN(CompanyName))
END 'Length'
FROM Customers
WHERE Country = 'Norway'
Screenshot