add explicit cast-null to any empty cell or cells that evaluate to
This commit is contained in:
parent
1b2cdf854b
commit
d2e3fc3cd8
@ -2208,28 +2208,36 @@ Public Function SQLp_build_sql_values(ByRef tbl() As String, trim As Boolean) As
|
|||||||
Select Case type_flag(j)
|
Select Case type_flag(j)
|
||||||
Case "N" '-------N = numeric but should probably be N for numeric----
|
Case "N" '-------N = numeric but should probably be N for numeric----
|
||||||
If tbl(j, i) = "" Then
|
If tbl(j, i) = "" Then
|
||||||
rec = rec & "NULL"
|
rec = rec & "CAST(NULL AS NUMERIC)"
|
||||||
Else
|
Else
|
||||||
rec = rec & Replace(tbl(j, i), "'", "''")
|
rec = rec & Replace(tbl(j, i), "'", "''")
|
||||||
End If
|
End If
|
||||||
Case "S" '-------S = string------------------------------------------
|
Case "S" '-------S = string------------------------------------------
|
||||||
|
If LTrim(RTrim(tbl(j, i))) = "" Then
|
||||||
|
rec = rec & "CAST(NULL AS VARCHAR(255))"
|
||||||
|
Else
|
||||||
If trim Then
|
If trim Then
|
||||||
rec = rec & "'" & LTrim(RTrim(Replace(tbl(j, i), "'", "''"))) & "'"
|
rec = rec & "'" & LTrim(RTrim(Replace(tbl(j, i), "'", "''"))) & "'"
|
||||||
Else
|
Else
|
||||||
rec = rec & "'" & Replace(tbl(j, i), "'", "''") & "'"
|
rec = rec & "'" & Replace(tbl(j, i), "'", "''") & "'"
|
||||||
End If
|
End If
|
||||||
|
End If
|
||||||
Case "D" '-------D = date---------------------------------------------
|
Case "D" '-------D = date---------------------------------------------
|
||||||
If LTrim(RTrim(tbl(j, i))) = "" Then
|
If LTrim(RTrim(tbl(j, i))) = "" Then
|
||||||
rec = rec & "CAST(NULL AS DATE)"
|
rec = rec & "CAST(NULL AS DATE)"
|
||||||
Else
|
Else
|
||||||
rec = rec & "'" & tbl(j, i) & "'"
|
rec = rec & "CAST('" & tbl(j, i) & "' AS DATE)"
|
||||||
End If
|
End If
|
||||||
Case Else '-------Assume text------------------------------------------
|
Case Else '-------Assume text------------------------------------------
|
||||||
|
If LTrim(RTrim(tbl(j, i))) = "" Then
|
||||||
|
rec = rec & "CAST(NULL AS VARCHAR(255))"
|
||||||
|
Else
|
||||||
If trim Then
|
If trim Then
|
||||||
rec = rec & "'" & LTrim(RTrim(Replace(tbl(j, i), "'", "''"))) & "'"
|
rec = rec & "'" & LTrim(RTrim(Replace(tbl(j, i), "'", "''"))) & "'"
|
||||||
Else
|
Else
|
||||||
rec = rec & "'" & Replace(tbl(j, i), "'", "''") & "'"
|
rec = rec & "'" & Replace(tbl(j, i), "'", "''") & "'"
|
||||||
End If
|
End If
|
||||||
|
End If
|
||||||
End Select
|
End Select
|
||||||
Next j
|
Next j
|
||||||
rec = rec & ")"
|
rec = rec & ")"
|
||||||
|
Loading…
Reference in New Issue
Block a user