troubleshooting Question

CROSS APPLY Issue

Avatar of Rickzzz
Rickzzz asked on
Microsoft SQL ServerSQL
4 Comments1 Solution56 ViewsLast Modified:
Not much experience with CROSS APPLY. Running into an issue LEFT JOIN would generally resolve, though not applicable here.

select
 t.refID
 z.dataPiece
from
 MyDataTable t
    CROSS APPLY myFunction(t.refID) z

t.refID may not always be what myFunction expects or is null, therefore those t.records are dropped. So if there's 100 records in MyDataTable, only 90 may result. I can't arbitrarily change t.refID if NULL or not the expected combination of characters (It's a vehicle's VIN btw). I also can't change the function to deal with it, as its used in other applications. Ideally the function would simply return NULL as a JOIN would. Thanks in advance for any assistance.
ASKER CERTIFIED SOLUTION
Máté Farkas
SQL Server Consultant
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros