Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
SQL
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 '.'


SQL
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
Posted
Updated 1-Mar-17 15:57pm
v2
Comments
Bryian Tan 1-Mar-17 19:29pm    
hmmm, that is odd. Anyway, my suggestion for now is to use one value from table cifa at a time and hard code the rest to narrow down which parameter giving problem.
CHill60 2-Mar-17 10:41am    
Do you have some sample data for table cifa? Might be worth sharing the TVF code too

1 solution

Its turns out it was the compatibility level of my database. I updated it from 80 to 100 and it works fine now

Thanks
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900