Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

vba to teradata sql - forum topic by mensssanvi

$
0
0

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
 
-----------------------

Forums: 

Viewing all articles
Browse latest Browse all 27759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>