All Forums Data Modeling
mensssanvi 4 posts Joined 04/13
25 Apr 2013
vba to teradata sql

Hi all, I'm sort of new to this site so forgive me if my posting doesn't make any sense -:). anyway, is there anyone out there that can help me replicate the below VBA code into teradata SQL? Thanks in advance
--------------
sqlstring2 = "SELECT M_Rel_Ttemp.wh_acc_no, M_Rel_Ttemp.wh_cust_no, M_Rel_Ttemp.cluster_no FROM Mortgage_Rel_Temp ORDER BY M_Rel_Ttemp.wh_acc_no ASC, M_Rel_Ttemp.cluster_no ASC"
    Set rst2 = thedb.OpenRecordset(sqlstring2, dbOpenDynaset)
   
    rst2.MoveFirst
    prev_fac = rst2!wh_acc_no
    prev_cust = rst2!wh_cust_no
    prev_clus = rst2!cluster_no
    rst2.MoveNext
   
    For i = 2 To rwnbr
        If rst2!cluster_no <> prev_clus Then
            If rst2!wh_acc_no = prev_fac Then
                rst2.Edit
                rst2!cluster_no = prev_clus
                ChangeCount = ChangeCount + 1
                rst2.Update
            Else
            End If
        Else
        End If
        prev_fac = rst2!wh_acc_no
        prev_cust = rst2!wh_cust_no
        prev_clus = rst2!cluster_no
       
        rst2.MoveNext
    Next i
   
    rst2.Close
 
-----------------------

You must sign in to leave a comment.