Quantcast
Viewing all articles
Browse latest Browse all 445

data format change of records in VBA recordset while fetching from Teradata

Hi,
 
As we know, we have facility to replace NULL values with anystring we want, in Teradata SQL Assistant.
The problem with me is I am fetching the data in a recordset in VBA from MS Excel. In this recordset I am not able to differentiate between NULL and Blank values.
I want to make it a fast processing thing thus using copyrecordset as follows:
objconn.Open "Provider=MSDASQL.1;Password=" + passwd + ";Persist Security Info=True;User ID=" + usrid + ";Data Source=" + server + "   "
objconn.commandtimeout = 0
sqlstr = concatenate() 'concatenating the SQL pasted in multiple lines
objrs.Open sqlstr, objconn
xlWs.Cells(2, 1).CopyFromRecordset objrs
 
As an alternate we can check for nulls in each row and column but it becomes very slow (as follows)
'objrs.MoveFirst
'Var = 2
'While Not objrs.EOF
'    For iCol = 1 To colcount
'        Val1 = objrs(objrs.Fields(iCol - 1).Name).Value
'        If IsNull(Val1) Then
'            Val1 = "NULL"
'        End If
'        xlWs.Cells(Var, iCol).Value = Val1
'    Next
'    objrs.MoveNext
'    Var = Var + 1
'Wend
Can someone help me in making this thing a fast working.
 
I posted this in connectivity section as I wanted to know is there any way we can activate the "facility to replace NULL values with any string we want", from VBA by doing something on the connection. Any argument or anything?
 
Please revert
 

Forums: 

Viewing all articles
Browse latest Browse all 445

Trending Articles