I need to create a loop that changes two items and I don't know how:
1 the variable in the sql - (c.cnty_cd = '11')
2 the database in the sql - (salti_person11)
so that each time the sql runs a new item from the array is inserted
for each of these.
Any help would be appreciated.
1 the variable in the sql - (c.cnty_cd = '11')
2 the database in the sql - (salti_person11)
so that each time the sql runs a new item from the array is inserted
for each of these.
Any help would be appreciated.
Code:
Dim strSql As String
Dim myCtyArray As Variant
Dim myDbArray As Variant
Dim x As Integer
myCtyArray = Array(1,2,11,B2) 'define CtyArray
myDbArray = Array(salti_person01,salti_person02,salti_person11,salti_personB2) 'define DbArray
strSql = "SELECT sp.deceased_dt, sp.gender_cd, sp.birth_dt, sp.deceased_dt_source_cd, sp.ms_pmi, c.cnty_cd," & _
"sp.south_index_id, sp.hispanic_cd, sp.south_ssn, p.estimated_birth_dt," & _
"[an.LAST_NAME] & ', ' & [an.FIRST_NAME] & ' ' & [an.MIDDLE_NAME] & ' ' & [an.NAME_SUFFIX] AS personname" & _
"FROM salti_person11 AS p, sw_south_person AS sp, sw_alias_name AS an, sw_county_pid AS c" & _
"WHERE p.south_index_id = sp.south_index_id" & _
"And an.south_index_id = sp.south_index_id" & _
"and c.south_index_id = sp.south_index_id" & _
"and (sp.hispanic_cd is null" & _
"and p.hispanic_cd is null)" & _
"and c.cnty_cd = '11'" & _
"and sp.deceased_dt is null" & _
"ORDER BY [an.LAST_NAME] & ', ' & [an.FIRST_NAME] & ' ' & [an.MIDDLE_NAME] & ' ' & [an.NAME_SUFFIX]);" 'define sql
For x = LBound(myArray) To UBound(myArray) 'define start and end of array
'run sql with c.cnty_cd as 01 and ssisPerson11 as sssisPerson01
Next x ' Loop!