Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Storage of binary files
Message
From
21/04/2002 16:43:09
 
General information
Forum:
Microsoft SQL Server
Category:
Database design
Miscellaneous
Thread ID:
00645848
Message ID:
00647394
Views:
15
>See FAQ #7995 How to work with Image field type on SQL Server (binary data).

According to the FAQ binary data stored in a text field gets corrupted.
Using the FileToStr() function would store the data as type character.
Would this avoid the corruption ?
pdf is a table
billpdf is textfield in the table
cstrfile is the result of the function

cstrfile = FileTostr('c:\xyz.pdf')
sqlRetVal = SQLEXEC( gnsqlserverHandle, ;
[update pdf ] + ;
[set billpdf = ['] + cstrfile + ['] ] +;
[ where ccustno='1234567' ] )
I have started to use this code to store pdf files to a sqlserver table.
I am retrieving the files using the StrToFile() function and so far they match. If you feel that I will be having problems in the future using
this code please let me know.
TIA
Noach

>>Hi,
>>
>>We have had a mechanism for distributing our applications and related files to desktops that has worked pretty well for us for several years. Basically we store the files (VFP.exe, word docs, etc) in the SQL database - split up into 8000Byte chunks - and then reassemble them via a loader program on each desktop. I'm getting ready to develop a new "loader" app that is more full featured and comprehensive in scope and seek opinions on this.
>>
>>1 - My biggest question is the wisdom/need/value of splitting the files up as opposed to just uploading entire (dynazipped) files into the database. The 'logic' behind the split had to do with being able to recover from partial loads if something went wrong. We would have no files more than a few meg in size - and most files are meadured in K.
>>
>>2 - What is the best data-type for loading binaries? binary? image? ? We've used binary in the past which explains the 8000 byte chunks. Image looks the most promising for larger files - is this accurate?
>>
>>3 - On the front end - is a VFP general field the only mechanism I have for moving the data up/down? Can I use filetostr()/strtofile()? something else?
>>
>>Thanks!
Previous
Reply
Map
View

Click here to load this message in the networking platform