I'm trying to use cross apply for the first time, and keep getting an error everytime I try.
If I hard coded the values it works fine, If I try to use the table values (which is the whole point), I get the error.
What I have tried:
-- I'm calling a TVF when I hard code the values this works fine
s
elect prs.*
from cifa addr
cross apply TVFParseSourceAddress('123 First Street',null,null,'Lake Mary FL 27344',null,null,null,null) prs
but when I try to call the function using the values from table cifa, it gives me an error. Incorrect syntax near '.'
select addr.ADDRESS1, addr.ADDRESS2, addr.CITY_STATE_ZIP
from cifa addr
cross apply TVFParseSourceAddress(addr.ADDRESS1,null,null,addr.CITY_STATE_ZIP,null,null,null,null) prs
I'm assuming since it works with hard coded values that it's not the TVF that's the problem, but I am stumped as to what the issue could be