all groups > sql server programming > september 2004 >
You're in the

sql server programming

group:

save/retrieve word document contents in image data type column


save/retrieve word document contents in image data type column juststarter
9/21/2004 11:05:01 PM
sql server programming: hi,
i have a word document. .
In the db , there is a table with a image column and i am trying to save the
contents of the clipboard into that column.
I have tried something like :

EXEC sp_dboption 'databaseName', 'select into/bulkcopy', 'true'
GO
DECLARE @ptrval binary(16)
SELECT @ptrval = TEXTPTR(imageColumn)
FROM tableName
Where [id] =1

WRITETEXT tableName.imageColumn @ptrval actualData
GO

EXEC sp_dboption 'databaseName', 'select into/bulkcopy', 'false'
GO

this saves the data in binary format, but the i can't read them !
i am using

DECLARE @textpointer varbinary(16)
SELECT @textpointer = TEXTPTR(imageColumn)
FROM tableName where [id]=1
READTEXT tableName .imageColumn @textpointer 1 50

but this returns the binary encoding of the data. :(
1. any ideas on what to do next?
2. does the image column preserve the original data format ? (ie: bullets,
bold font, talbes etc)
3. should i use another data type ? (ntext maybe?)
thx :)

ps: i don't want to save the word document file to the db, just the contents
RE: save/retrieve word document contents in image data type column John Bell
9/21/2004 11:47:03 PM
Hi

The formatting of your word document is embeded in the document itself,
therefore if you just store the text you will loose this. If you do not
translate this in the front end it will appear as binary. Alternatively you
could convert the documents before inserting the data (to say RTF) and use
ntext or provide a link to the file in the database.


John


[quoted text, click to view]
RE: save/retrieve word document contents in image data type column juststarter
9/22/2004 5:31:02 AM
thx for your help john..
i still have a prob showing the results in the word doc (back from the db)
but i suppose this is another's newsgroup area !


[quoted text, click to view]
Re: save/retrieve word document contents in image data type column jbellnewsposts NO[at]SPAM hotmail.com
9/22/2004 12:01:16 PM
Hi

As I said.. it is a binary format and you will not be able to read it
with the tools available with SQL Server.

John

[quoted text, click to view]
AddThis Social Bookmark Button