General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Storing Word documents in SQL Server
Hi All,
In our application we have a document database which is used to store documents.
The document database basically holds the file in a Memo field, we achieve this by reading the file into a memvar using low level file functions.
Like this:
w_retval = ""
w_fh = FOPEN(p_fn, 0)
IF w_fh >= 0
w_flen = FSEEK(w_fh, 0,2)
=FSEEK(w_fh, 0,0)
w_retval = FREAD(w_fh, w_flen)
=FCLOSE(w_fh)
ENDIF
This works perfectly under FoxPro but under SQL we keep getting corruptions. In this case we have specifically seen the problem against Word documents where they get uploaded and then when we try to open them through the system they cannot open because they are corrupt.
Even if we download the file outside of our application the file it creates is still corrupt.
However, I have done some work on this and by using ADO to bypass the view I can load the same data into sql and retrieve it without corruption.
In SQL we map Foxpro memo fields to Text fields, I have read somewhere that when saving data to a Text field in SQL Server that characters are modified and that its better to use the Image type to store this sort of information.
Is this reliable information?
I am currently thinking the only way around this is to use ADO, but this is going to require quite alot of work and was looking for a little inspiration.
Any help on this would be appreciated.
Jon
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only