You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "noorul11@gmail.com" <no...@gmail.com> on 2014/08/19 13:33:38 UTC

Sub Query is not working with SQL Server

HI,

I have written this query. it is working in query builder but when try to
run through camel it shows the following error

"com.microsoft.sqlserver.jdbc.SQLServerException:
com.microsoft.sqlserver.jdbc.SQLServerException: Invalid column name
'ADDRESS_EMAIL'."


SELECT distinct TOP 1 MOBILE,FAX,ADDRESS_EMAIL,
(case when((select count(*) from urole where r_id = 3 and U_ID = ID)>0) then
1 else 0 end as ROLE,
case when((select count(*) from urole where r_id = 4 and u_id = ID) > 0)
then 1 else 0 end as ADMIN,
case when((select count(*) from urole  where r_id = 2 and u_ID = ID)>0) then
1 else 0 end as VENDOR,
case when((select count(*) from urole  where r_id =9 and u_id = ID)>0) then
1 else 0 end as NO_SURVEY_FLAG) from myuser 
where ADDRESS_EMAIL = :?emailID

Note : I have used the following driver 
          sqljdbc4

Let me know what went wrong.

Thanks,
Noorul



--
View this message in context: http://camel.465427.n5.nabble.com/Sub-Query-is-not-working-with-SQL-Server-tp5755388.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: Sub Query is not working with SQL Server

Posted by "noorul11@gmail.com" <no...@gmail.com>.
Which Camel component?
camel-jdbc

Which version?
camel version 2.13.0

Can you share your route? 

<route id="GetCustomerByEmail">  
            <from id="GetCustomerByEmail"               
uri="direct:getCustomerByEmail" />     
            <setHeader headerName="EmailId"> 
 				<simple>{{customer.emailid}}</simple> 
 			</setHeader> 
            <setBody> 
         		<constant>SELECT distinct TOP 1 MOBILE,FAX,ADDRESS_EMAIL,(case
when((select count(*) from urole where r_id = 3 and U_ID = ID)>0) then 1
else 0 end as ROLE, case when((select count(*) from urole where r_id = 4 and
u_id = ID) > 0) then 1 else 0 end as ADMIN, case when((select count(*) from
urole  where r_id = 2 and u_ID = ID)>0) then 1 else 0 end as VENDOR, case
when((select count(*) from urole  where r_id =9 and u_id = ID)>0) then 1
else 0 end as NO_SURVEY_FLAG) from myuser where ADDRESS_EMAIL = :?emailID
</constant>
      		</setBody>        
      		<to uri="jdbc:iceDataSource"/>
      		<split> 
         		<simple>${body}</simple> 
         		<log message="*** Select all : ${body}"/> 
       		</split> 
        </route> 



--
View this message in context: http://camel.465427.n5.nabble.com/Sub-Query-is-not-working-with-SQL-Server-tp5755388p5755420.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: Sub Query is not working with SQL Server

Posted by Christian Müller <ch...@gmail.com>.
Which Camel component?
Which version?
Can you share your route?

Best,
Christian
Am 19.08.2014 14:13 schrieb "noorul11@gmail.com" <no...@gmail.com>:

> HI,
>
> I have written this query. it is working in query builder but when try to
> run through camel it shows the following error
>
> "com.microsoft.sqlserver.jdbc.SQLServerException:
> com.microsoft.sqlserver.jdbc.SQLServerException: Invalid column name
> 'ADDRESS_EMAIL'."
>
>
> SELECT distinct TOP 1 MOBILE,FAX,ADDRESS_EMAIL,
> (case when((select count(*) from urole where r_id = 3 and U_ID = ID)>0)
> then
> 1 else 0 end as ROLE,
> case when((select count(*) from urole where r_id = 4 and u_id = ID) > 0)
> then 1 else 0 end as ADMIN,
> case when((select count(*) from urole  where r_id = 2 and u_ID = ID)>0)
> then
> 1 else 0 end as VENDOR,
> case when((select count(*) from urole  where r_id =9 and u_id = ID)>0) then
> 1 else 0 end as NO_SURVEY_FLAG) from myuser
> where ADDRESS_EMAIL = :?emailID
>
> Note : I have used the following driver
>           sqljdbc4
>
> Let me know what went wrong.
>
> Thanks,
> Noorul
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Sub-Query-is-not-working-with-SQL-Server-tp5755388.html
> Sent from the Camel Development mailing list archive at Nabble.com.
>