External Article

Red Gate Photo Competition!

Most of the time, it's the simplest tools that have the biggest impact on our lives. If you have a camera and believe, like Leonardo DaVinci, that simplicity is the ultimate sophistication, then why not enter Red Gate's Ingeniously Simple Tools photo competition...
To enter is simple. All you need to do is send us a photo of your favorite, simple tool.

SQLServerCentral Article

Handling Zero Byte Files in DTS

SQL Server 2005 has substantially enhanced its ETL capabilities, but many people will still be working with DTS in SQL Server 2000 for many years. New author James Greaves brings us a technique for working with imports and handling files that might not have any data.

Technical Article

Healthcare Data Models Matter

Healthcare applications come and go, but data live on forever. We’ve seen that since the beginning of the computer industry; when we move from legacy systems into more “modern” architectures, we often leave behind applications, but we almost always take along the data into the future. Even though data are so important, we in health-IT don’t seem to spend the quality time necessary to structure our schemas and databases in such a way as to make it easier to maintain in the future. We often don’t design our data models solidly, and we don’t test them well by putting them through simulations or design them for multiple versions.

SQLServerCentral Article

Lookup Table Madness

Are you mad? Not angry, more like crazy when it comes to designing databases in SQL Server? Don Peterson has met a few people he thinks are just that when it comes to building lookup tables. Does it stem from poor understanding of database design? Or do you disagree? Read Don's case against this particular design practice.

Blogs

Troubleshooting TempDB Log Full Errors When SSMS Won’t Connect

By

Have you ever received the dreaded error from SQL Server that the TempDB log...

Accelerating AI with Confidence: Why Microsoft Purview is Key to Responsible Innovation

By

Artificial intelligence is no longer a distant concept. It is here, embedded in the...

The Mystery of SQL Server 2025’s New Tricks – Scooby Dooing Episode 5

By

Every Scooby-Doo mystery starts with a haunted house, a strange villain, and a trail...

Read the latest Blogs

Forums

The Tightly Linked View

By Steve Jones - SSC Editor

Comments posted to this topic are about the item The Tightly Linked View

Build a Test Lab of SQL Server 2025 on Windows Server 2025 using Hyper-V Virtual Machines

By Aleksey Vitsko

Comments posted to this topic are about the item Build a Test Lab of...

Remembering Phil Factor

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Remembering Phil Factor

Visit the forum

Question of the Day

The Tightly Linked View

I try to run this code on SQL Server 2022. All the objects exist in the database.

CREATE OR ALTER VIEW OrderShipping
AS
SELECT cl.CityNameID,
       cl.CityName,
       o.OrderID,
       o.Customer,
       o.OrderDate,
       o.CustomerID,
       o.cityId
 FROM dbo.CityList AS cl
 INNER JOIN dbo.[Order] AS o ON o.cityId = cl.CityNameID
GO
CREATE OR ALTER FUNCTION GetShipCityForOrder
(
    @OrderID INT
)
RETURNS VARCHAR(50)
WITH SCHEMABINDING
AS
BEGIN
    DECLARE @city VARCHAR(50);
    SELECT @city = os.CityName
    FROM dbo.OrderShipping AS os
    WHERE os.OrderID = @OrderID;
    RETURN @city;
END;
go
What is the result?

See possible answers