Reputation: 11578
I'm using SQL Server 2005 and I only can use Management Studio (it's a staging/production server). I need to save a zip file from local machine (server) into a blob field.
I do this:
create table CFile (id int, thefile varbinary(max))
INSERT INTO CFile
(id, thefile)
SELECT 1,
BulkColumn FROM OPENROWSET(
Bulk 'C:\test.zip', SINGLE_BLOB) AS BLOB
and was ok, but then when:
SELECT * FROM CFile
I saw the row but I can't see the data in thefile field, and is not null (checked also with ISNULL function)
So there is the data but I'cant read it? why? How i retrieve it from Management Studio again, at least as varchar?
I try with
INSERT INTO CFile (id, thefile) VALUES (3,cast('asasdfadsfadsfdsafadsfasdfadsfasdfd' as varbinary))
and it works, I can see the content of the field.
Any help or tip in this will be preciated.
Thanks
Upvotes: 1
Views: 595
Reputation: 25258
I'm pretty sure SQL management viewer does not have a BLOB viewer. You will have to save it back to a file.
You can check with DATALENGTH(thefile) to test if the field was loaded.
Upvotes: 2