Dears Please help me pass multiple CPs to find the Process Ids from any one of the following table .
I want to do something like this :
declare @CP varchar(30)
Set @CP ='684980','123123','456456'
select ESuser.tb_pt_servicerequest.process_instance_id, ESuser.tb_pt_servicerequest.cpno
from
ESuser.tb_pt_servicerequest where ESuser.tb_pt_servicerequest.cpno in (@CP)
union all
select ESuser.tb_pt_additionalcp.process_instance_id, ESuser.tb_pt_additionalcp.cpno
from
ESuser.tb_pt_additionalcp where ESuser.tb_pt_additionalcp.cpno in (@CP)
OR like this
select * from XXXX, WWW, MMMM, KKK where CP_NO in ('123123','123321','123567')
Using this , But here I am unable to pass multiple cp number to get the returns : Now in this variable i can pass one value like '123123' and can get the results , but if i change the query to like in ('123123','123321') instead of =('123123'), I could not get the results . :(
declare @CP varchar(10)
Set @CP ='684980 '
select ESuser.tb_pt_servicerequest.process_instance_id, ESuser.tb_pt_servicerequest.cpno
from
ESuser.tb_pt_servicerequest where ESuser.tb_pt_servicerequest.cpno = @CP
union all
select ESuser.tb_pt_additionalcp.process_instance_id, ESuser.tb_pt_additionalcp.cpno
from
ESuser.tb_pt_additionalcp where ESuser.tb_pt_additionalcp.cpno = @CP
union all
select ESuser.tb_pt_new_addtionalcp.process_instance_id, ESuser.tb_pt_new_addtionalcp.cpno
from
ESuser.tb_pt_new_addtionalcp where ESuser.tb_pt_new_addtionalcp.cpno = @CP
union all
select ESuser.tb_pt_vip_service_request.process_instance_id,
ESuser.tb_pt_vip_service_request.cpno
from
ESuser.tb_pt_vip_service_request where ESuser.tb_pt_vip_service_request.cpno = @CP
union all
select
ESuser.tb_pt_vip_additional_cp.process_instance_id,ESuser.tb_pt_vip_additional_cp.cpno
from
ESuser.tb_pt_vip_additional_cp where ESuser.tb_pt_vip_additional_cp.cpno = @CP
union all
select ESuser.tb_pt_servicerequestbypass.process_instance_id, ESuser.tb_pt_servicerequestbypass.cpno
from
ESuser.tb_pt_servicerequestbypass where ESuser.tb_pt_servicerequestbypass.cpno = @CP
likekeyword inSQL..exampleSELECT * FROM table, table1, table2 WHERE column LIKE '%contains%'.