insert into clients(`id`, `cod`, `name`, `Phone`)
select `id`, `cod`, insert(name,1,2,’José’) , `Phone` from clients where `name` =’Zé Carlos’
Tag Archive: VBscript
Division with 2 Decimal Digits
aLeft = 190100
aRight = 190 mod 100
Height = aLeft & “.” & aRight
Function ReadSiteFile(strHDLocation)
Const ForReading = 1
Set fso = CreateObject(“Scripting.FileSystemObject”)
Set theFile = fso.OpenTextFile(strHDLocation, ForReading, False)
idx = 0
Do Until theFile.AtEndOfStream
retstring = theFile.Readline
idx = idx + 1
Redim Preserve HtmlTxt(idx)
HtmlTxt(idx – 1) = retstring
Loop
Set fso = CreateObject(“Scripting.FileSystemObject”)
Set theFile = fso.OpenTextFile(strHDLocation, ForReading, False)
idx = 0
Do Until theFile.AtEndOfStream
retstring = theFile.Readline
idx = idx + 1
Redim Preserve HtmlTxt(idx)
HtmlTxt(idx – 1) = retstring
Loop
theFile.Close
ReadSiteFile = HtmlTxt
ReadSiteFile = HtmlTxt
End Function
Sub XMLImport(strFileURL, strHDLocation)
Set objXMLHTTP = CreateObject(“MSXML2.XMLHTTP”)
objXMLHTTP.open “GET”, strFileURL, false
objXMLHTTP.send
If objXMLHTTP.Status = 200 Then ‘ “URL Exists!”
Set objADOStream = CreateObject(“ADODB.Stream”)
with objADOStream
.Open
.Type = 1
.Write objXMLHTTP.ResponseBody
.Position = 0
End with
Set objFSO = Createobject(“Scripting.FileSystemObject”)
If objFSO.Fileexists(strHDLocation) Then
objFSO.DeleteFile strHDLocation
End if
Set objFSO = Nothing
objADOStream.SaveToFile strHDLocation
objADOStream.Close
Set objADOStream = Nothing
End if
Set objXMLHTTP = Nothing
objXMLHTTP.open “GET”, strFileURL, false
objXMLHTTP.send
If objXMLHTTP.Status = 200 Then ‘ “URL Exists!”
Set objADOStream = CreateObject(“ADODB.Stream”)
with objADOStream
.Open
.Type = 1
.Write objXMLHTTP.ResponseBody
.Position = 0
End with
Set objFSO = Createobject(“Scripting.FileSystemObject”)
If objFSO.Fileexists(strHDLocation) Then
objFSO.DeleteFile strHDLocation
End if
Set objFSO = Nothing
objADOStream.SaveToFile strHDLocation
objADOStream.Close
Set objADOStream = Nothing
End if
Set objXMLHTTP = Nothing
End Sub
