Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

Interesting non-error using WHERE with NOT IN

$
0
0
I came across an interesting non-error in SQL Server 2014 EE with a where condition that uses a not in... The field name in the select statement within the not in is invalid. The correct field name is Feed_Name but FeedName is in the statement. The statement with the not in will run w/o error and return 0 results. If I run the statement alone it will produce an error. This is a little concerning for me and I am curious if anyone super smart knows why???--Query with incorrect field name in NOT INSELECT FeedName , 'Missing FileTableDB Record - External Feed' AS Alert_TypeFROM Alert.Export_FilesWHERE FeedName NOT IN ( SELECT DISTINCT FeedName FROM FileTableDB.dbo.External_Feed_Lookup );GOSELECT DISTINCT FeedNameFROM FileTableDB.dbo.External_Feed_Lookup;GO

Viewing all articles
Browse latest Browse all 3145

Trending Articles