By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,758 Members | 1,264 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,758 IT Pros & Developers. It's quick & easy.

Retrieving BLOB files from MSSQL in VBa

P: 1
Hi everyone,

I got an annoying thing going on.
I've got an MSSQL db which is filled with different data, used by another program (T-Plan). I should read some table to import in another DB. The DB I have to read, contains als BLOB files.
In Excel I created a connection string, can read all fields & values as shown in the DB, but I can't manage to convert the Blobs to Strings (which is the data in the BLOBs).
I tried all the next, but unsuccesful: (when reading the data stream and adding values to the excel sheet.
Cells(rowcount, tel) = StrConv(rst.Fields(tel - 1), vbFromUnicode)

Cells(rowcount, tel) = GetString(rst.Fields(tel - 1))

Cells(rowcount, tel) = Asc(rst.Fields(tel - 1))

sAns = StrConv(rst.Fields(tel - 1), vbFromUnicode)
iPos = InStr(sAns, Chr(0))
If iPos > 0 Then sAns = Left(sAns, iPos - 1)
Cells(rowcount, tel) = sAns

Cells(rowcount, tel) = rst.Fields(tel - 1)

Pls take a look at the screenshot to see some of the 'blob' values in the SQL db.
Pls notice also that all BLOB files / values, contain 32 characters when show in DB view & when exported to excel.

[IMG][/IMG]

An alterantive to convert this data when allready exported to excel, could also help me a lot !

thanks for any feedback.
Koen
Jan 8 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.