May 27, 2004 at 9:35 pm
I need your help.
If I have a table X that has columns A bigint and B image; how can I extract to a data file with the names being the value of A and content being the data in the image B.
In other words, I want to get the blob data to a disk file.
Thanks in advance.
Phil
May 31, 2004 at 8:00 am
This was removed by the editor as SPAM
May 31, 2004 at 1:15 pm
I agree with noeld that there are definitely a lot of ways to do this. From a T-SQL point of view, I found the following useful link, which creates user functions in SQL Server to write the BLOB contents to a file. Using these functions and stored procedures, you can create a cursor to step through each row in the table and create the necessary image files:
First download NTEXTCODE.exe from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsqlpro03/html/sp03g8.asp
After compiling the procedures and functions use a cursor:
DECLARE @filename VARCHAR(255)
DECLARE @where VARCHAR(400)
declare image_crs cursor for
select <PathColumn> FROM <ImageTable>
open image_crs
fetch image_crs into @filename
while @@fetch_status >= 0
begin
SET @where = 'where <PathColumn>=''' + @filename + ''''
exec master..saveImage2file @filename, '<DB>..<ImageTable>', '<ImageColumn>', @where
fetch image_crs into @filename
end
deallocate image_crs
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply