I'm a complete newbie to T-SQL, but have a pretty solid understanding of constructing SQL statements (queries), and VBA. I'm working on a project converting an access database into a SQL database (no front end will remain in access).
I'm hoping someone can tell me this will be simple, and if not, help point me in the right direction!
Here's my VBA function I need to make work in SQL as a stored procedure: (SQL Table / field names are the same as the ones referenced here)
Public Function getText(var_OID, var_SYNTAX, var_VALUE)
Dim strTemp, strValue As String
strTemp = var_OID
Select Case var_SYNTAX
Case "OBJECT IDENTIFIER"
'field contains object identifier
getText = DLookup("my_description", "tblLrcsMib", "my_OID = '" & var_VALUE & "'")
Exit Function
Case "TimeTicks"
'field contains time ticks
getText = "timeTicks"
Exit Function
Case Else
'field doesn't contain object identifier, keep removing 1 from the OID until it's resolved against the MIB
Do Until getText <> ""
'lookup modified OID in MIB table
getText = DLookup("my_description", "tblLrcsMib", "my_OID = '" & strTemp & "'")
'Found matching MIB, quit the function
If getText <> "" Then
Exit Function
Else
'didn't find matching MIB, remove another character from the OID
strTemp = Left(strTemp, Len(strTemp) - 1)
End If
Loop
End Select
End Function
I'm hoping someone can tell me this will be simple, and if not, help point me in the right direction!
Here's my VBA function I need to make work in SQL as a stored procedure: (SQL Table / field names are the same as the ones referenced here)
Public Function getText(var_OID, var_SYNTAX, var_VALUE)
Dim strTemp, strValue As String
strTemp = var_OID
Select Case var_SYNTAX
Case "OBJECT IDENTIFIER"
'field contains object identifier
getText = DLookup("my_description", "tblLrcsMib", "my_OID = '" & var_VALUE & "'")
Exit Function
Case "TimeTicks"
'field contains time ticks
getText = "timeTicks"
Exit Function
Case Else
'field doesn't contain object identifier, keep removing 1 from the OID until it's resolved against the MIB
Do Until getText <> ""
'lookup modified OID in MIB table
getText = DLookup("my_description", "tblLrcsMib", "my_OID = '" & strTemp & "'")
'Found matching MIB, quit the function
If getText <> "" Then
Exit Function
Else
'didn't find matching MIB, remove another character from the OID
strTemp = Left(strTemp, Len(strTemp) - 1)
End If
Loop
End Select
End Function