LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parallel database connections and single query between databases

Hi, I am looking to execute this SQL query between 2 different databases to update a local database based on data selected from a remote one.

 

 

e.g.:

- Local database name: db1

- local database schema: dbo

- local database table1

- remote database name: db2

- remote database schema: dbo

- Remote database table: table2

 

- Query: "SELECT * FROM db2.dbo.table2 WHERE NOT EXISTS(SELECT * FROM db1.dbo.table1)" <- This gets e the record set i would need to insert, and I already have a vi to do that kinda thing.

 

How do I go about this?

 

Thanks,

 

Mohamed

0 Kudos
Message 1 of 3
(2,032 Views)

Mohamed,

 

There is a VI in the Database Connectivity Toolkit that allows you to execute SQL queries:  DB Tools Execute Query.

 

http://zone.ni.com/reference/en-XX/help/370016E-01/lvdatabase/db_tools_execute_query/

 

Is this what you are looking for?

Drew T.
Camber Ridge, LLC.
0 Kudos
Message 2 of 3
(2,012 Views)

Well if you are asking how to do this with an SQL expression you can not. That is an SQL limitation. Some servers may have proprietary methods for that but I am not aware of this. Just select the data,  save it to an array or cluster or whatever, then do an insert on the other table with the results.

=====================
LabVIEW 2012


0 Kudos
Message 3 of 3
(2,010 Views)