cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
266
Views
0
Helpful
1
Replies
LabanM
Beginner

CCX Database Query erroring

I'm working on a new script that pulls customer information and multiple databases have to be queried to get the data. However my query is failing to pull any data and I'm not sure why. Do I need to have my connection string include both databases? If so how?

 

This query errors.

select site_no, site_name from DATABASE1.dbo.tablename s WITH (NOLOCK) where phone1 = $strANI OR phone2 = $strANI or site_no IN (Select site_no from DATABASE2.dbo.tablename2 where phoneNumber = $strANI )

This query works fine.

select site_no, site_name from DATABASE1.dbo.tablename s WITH (NOLOCK) where phone1 = $strANI OR phone2 = $strANI

My database connection string

jdbc:jtds:sqlserver://sql.example.local/Database1:1433;instanceName=MSSQLSERVER

 

1 REPLY 1
Elliot Dierksen
Rising star

I would suggest creating an alias or a view in DATABASE1 for the table in DATABASE2. I have definitely had issues with using more complex SQL statements in CCX DB queries. Otherwise you might have to do separate queries to different data sources.

Create
Recognize Your Peers
Content for Community-Ad