ClimoC
Well-known Member
- Joined
- Aug 21, 2009
- Messages
- 584
Howdy How
Just getting into more SQL heavy orientated stuff to work things a bit smarter and faster when I then start vba/excel'ing with my recordset
The datatype on the server (PL/SQL Oracle), like a lot of them, is in text format
so after reading up on the CAST function, I can successfully bring in the recordset, with another column appended, which is the date column, but with a datatype 135 (adDBTimeStamp)
Just wondering, I think there's a CONVERT function, which doesn't look exactly what I'm after... so I sort of have two small questions...
1) Can what is 'CAST' be returned as/in place of the actual column? That is, instead of having a redundant text formatted date field with an appended date field, I can just swap the former for the latter?
and
2) Does anyone know the datatype to cast it as so that it returns as a datatype 7? (adDate, rather than a 135 adDBTimeStamp)
Thanks
C
Just getting into more SQL heavy orientated stuff to work things a bit smarter and faster when I then start vba/excel'ing with my recordset
The datatype on the server (PL/SQL Oracle), like a lot of them, is in text format
so after reading up on the CAST function, I can successfully bring in the recordset, with another column appended, which is the date column, but with a datatype 135 (adDBTimeStamp)
Just wondering, I think there's a CONVERT function, which doesn't look exactly what I'm after... so I sort of have two small questions...
1) Can what is 'CAST' be returned as/in place of the actual column? That is, instead of having a redundant text formatted date field with an appended date field, I can just swap the former for the latter?
and
2) Does anyone know the datatype to cast it as so that it returns as a datatype 7? (adDate, rather than a 135 adDBTimeStamp)
Code:
var1 = "SELECT *, CAST(schedule_date_raw AS DATE)" & vbCrLf & "FROM schedule_export_chris" & vbCrLf & " WHERE schedule_date_raw = '20121201'"
With cnImportConn
.CursorLocation = adUseClient
.Open strConn
.CommandTimeout = 0
Set RecSet = .Execute(var1, adOpenForwardOnly, adLockReadOnly)
End With
Thanks
C