blob in mssqlserver
''' large field shall use UPDATETEXT feature of MSSQLSERVER
''' AppendChunk does not work for fields large than 60MB
''' MSSQLSERVER blob processing: DATALENGTH UPDATETEXT ...
Set rs=CreateObject("ADOdb.recordset")
Set con = CreateObject("adodb.connection")
con.CommandTimeout = 1000000
con.open "Provider=SQLOLEDB;Data Source=;Initial Catalog=SC;User ID=sa;Password=kodak;"
adOpenStatic = 3
adLockOptimistic = 3
adCmdTable = 2
adCmdText = 1
adPersistXML = 1
adCmdUnknown = 8
adOpenKeyset = 1
adTypeBinary = 1
dim start_time
start_time = Now()
table_name = "blobtable"
rs.open table_name ,con,adOpenKeyset,adLockOptimistic,adCmdUnknown
for i = 1 to 10
set stream = createobject("ADODB.Stream")
stream.Type = adTypeBinary
stream.Open
stream.LoadFromFile "D:\Onega\020.pdf"
RS.Fields("blobfield").AppendChunk stream.Read
set stream = nothing
next
rs.update
rs.close
con.close
end_time = Now()
MsgBox "process blob field takes " & CStr(DateDiff("s",start_time,end_time)) & " seconds"
''' AppendChunk does not work for fields large than 60MB
''' MSSQLSERVER blob processing: DATALENGTH UPDATETEXT ...
Set rs=CreateObject("ADOdb.recordset")
Set con = CreateObject("adodb.connection")
con.CommandTimeout = 1000000
con.open "Provider=SQLOLEDB;Data Source=;Initial Catalog=SC;User ID=sa;Password=kodak;"
adOpenStatic = 3
adLockOptimistic = 3
adCmdTable = 2
adCmdText = 1
adPersistXML = 1
adCmdUnknown = 8
adOpenKeyset = 1
adTypeBinary = 1
dim start_time
start_time = Now()
table_name = "blobtable"
rs.open table_name ,con,adOpenKeyset,adLockOptimistic,adCmdUnknown
for i = 1 to 10
set stream = createobject("ADODB.Stream")
stream.Type = adTypeBinary
stream.Open
stream.LoadFromFile "D:\Onega\020.pdf"
RS.Fields("blobfield").AppendChunk stream.Read
set stream = nothing
next
rs.update
rs.close
con.close
end_time = Now()
MsgBox "process blob field takes " & CStr(DateDiff("s",start_time,end_time)) & " seconds"
0 Comments:
Post a Comment
<< Home