SQL Server The column name is not valid
by mfoley from LinuxQuestions.org on (#6CPH2)
Normally I'd ask this question on the Micosoft answers forum, but since they now want me to download the Microsoft Authenticator app to my phone, I'm not interested. LQ people seem to know stuff like this so I'll try here.
I'm running Slackware64 14.2, Java 17.0.2 and Tomcat10.0.17.
I'm running a query in java/jsp which is giving me an error:
Code:select a.allocationAmount, c.totalCredit
from WTWpreMedicareSvcAmount a
left join vwWTWpreMedicareServiceCredit c on c.memberId = '123456'
where a.effYear = 2023 and a.serviceCredit = case when c.totalCredit is null then 20 when c.totalCredit > 30 then 30 else c.totalCredit end
Exception in thread "main" com.microsoft.sqlserver.jdbc.SQLServerException: The column name totalCredit is not valid.Yet if I run this query using just java it works:
Code:select a.allocationAmount, c.totalCredit
from WTWpreMedicareSvcAmount a
left join vwWTWpreMedicareServiceCredit c on c.memberId = '123456'
where a.effYear = 2023 and a.serviceCredit = case when c.totalCredit is null then 20 when c.totalCredit > 30 then 30 else c.totalCredit end
allocationAmount totalCredit
---------------- ----------------------------------------
480.0000Any idea why I get the column name not valid when run within jsp? I believe both Java and jsp are using sqljdbc42.jar.
I'm running Slackware64 14.2, Java 17.0.2 and Tomcat10.0.17.
I'm running a query in java/jsp which is giving me an error:
Code:select a.allocationAmount, c.totalCredit
from WTWpreMedicareSvcAmount a
left join vwWTWpreMedicareServiceCredit c on c.memberId = '123456'
where a.effYear = 2023 and a.serviceCredit = case when c.totalCredit is null then 20 when c.totalCredit > 30 then 30 else c.totalCredit end
Exception in thread "main" com.microsoft.sqlserver.jdbc.SQLServerException: The column name totalCredit is not valid.Yet if I run this query using just java it works:
Code:select a.allocationAmount, c.totalCredit
from WTWpreMedicareSvcAmount a
left join vwWTWpreMedicareServiceCredit c on c.memberId = '123456'
where a.effYear = 2023 and a.serviceCredit = case when c.totalCredit is null then 20 when c.totalCredit > 30 then 30 else c.totalCredit end
allocationAmount totalCredit
---------------- ----------------------------------------
480.0000Any idea why I get the column name not valid when run within jsp? I believe both Java and jsp are using sqljdbc42.jar.