Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Urgent please

Status
Not open for further replies.

rajivg

Programmer
Oct 29, 2001
5
GB
This is a sql query wirtten in vb. this query works fine with sql server. but with paradox it does because in the query "IF EXISTS" is there and Paradox does not understand IF EXISTS. IS there any other way we can write this query and keep the meaning the same too as the orgianal one. Please advise, its urgent. regards rajiv


GetClientRs f_hierarchy.connectstring, _
"IF EXISTS(" _
+ "SELECT * " _
+ "FROM term_prop " _
+ "WHERE hier_id=" & f_hierarchy.id & " " _
+ "AND term_id=" & f_term_id & " " _
+ "AND hier_prop_id=" & f_propertydefinition.id & ") " & vbCrLf _
+ "UPDATE term_prop SET hier_prop_value_id=" & pdvid & " " _
+ "WHERE hier_id=" & f_hierarchy.id & " " _
+ "AND term_id=" & f_term_id & " " _
+ "AND hier_prop_id=" & f_propertydefinition.id & " " _
+ " ELSE " _
+ "INSERT INTO term_prop (hier_id, term_id, hier_prop_id, hier_prop_value_id) " _
+ "VALUES " _
+ "(" & f_hierarchy.id & "," & f_term_id & "," & f_propertydefinition.id & "," & pdvid & ")"
 
Im not familar with "if Exist" but its look like "if i found at least 1 matching record". So far i have never saw something like that in standar SQL, i guess its a microsoft keyword. If i had to solve that problem i guess i ll go that way :

Executing the Select in a TCursor
IF MyTcursor.nRecords()>0 then //if exist
Update Querry
else
Insertion Querry
endif

hope this help
jb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top