byte problem
Posted in 2010
Topics: General Discussion
HI, I have a byte column named docset,the customer want to see some head information in the byte column, for example docset[1,2000], How to implement in Store procedure? Any suggestion would be welcomed.
CHUAN LU wrote: > > I have a byte column named docset,the customer want to see some head > information in the byte column, for example docset[1,2000], How to implement > in Store procedure? If I was trying to get there, I wouldn't start from where you are. -- Cheers, Obnoxio The Clown http://obotheclown.blogspot.com I will now proceed to pleasure myself with this fish. -- This message has been scanned for viruses and dangerous content by OpenProtect(http://www.openprotect.com), and is believed to be clean.
Hi, the problem is that you are using a byte column, probably for a non byte content, but a text content. Byte columns are designed to store a whole byte stream which can be anything. You can only retrieve the whole data. It does not make sense look at the first 2000 bytes of maybe a jpg file, a word document or a pdf file, maybe in zipped form. In case you want to store unlimited text data, use a text data type. This should be easier to get a look at the first 2000 bytes. I do not think, you can get the bytes out of the column, get the first 2000 bytes within a stored procedure and return it in string form (which encoding should be used, data might be zipped etc.). At least there is no internal conversion for byte to varchar or anything similar. Maybe you should use a java procedure to do the trick, however this only will work if you "know" what data is inside and how it is interpreted. Good luck, Marcus -----Original Message----- From: Obnoxio The Clown [mailto:obnoxio@serendipita.com] Sent: Thursday, September 16, 2010 10:10 PM To: ids@iiug.org Subject: Re: byte problem [21334] CHUAN LU wrote: > > I have a byte column named docset,the customer want to see some head > information in the byte column, for example docset[1,2000], How to > implement in Store procedure? If I was trying to get there, I wouldn't start from where you are. -- Cheers, Obnoxio The Clown http://obotheclown.blogspot.com I will now proceed to pleasure myself with this fish. -- This message has been scanned for viruses and dangerous content by OpenProtect(http://www.openprotect.com), and is believed to be clean. ************************************************************************ ******* Forum Note: Use "Reply" to post a response in the discussion forum.