Friends, I'd like to examine bytes 40 through 47 of a very large IMAGE field
in records in one table. I'd like to handle the bytes as text if possible.
A simple litle utility is needed by our customer, so I had hoped to avoid
doing the utility in C++, and thought maybe perhaps I could hanlde this all
as a SQL script. (I looked around, and it doesn't appear SQL really lets
you work with binary.)
Any ideas will be greatly appreciated. (Otherwise, I'll just code up a
little C++/ODBC app for them.)
Thanks in advance,
JamesDid you try SUBSTRING?
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--
"James Hunter Ross" <james.ross@.oneilsoft.com> wrote in message
news:upYfBsLKFHA.1280@.TK2MSFTNGP09.phx.gbl...
> Friends, I'd like to examine bytes 40 through 47 of a very large IMAGE
field
> in records in one table. I'd like to handle the bytes as text if
possible.
> A simple litle utility is needed by our customer, so I had hoped to avoid
> doing the utility in C++, and thought maybe perhaps I could hanlde this
all
> as a SQL script. (I looked around, and it doesn't appear SQL really lets
> you work with binary.)
> Any ideas will be greatly appreciated. (Otherwise, I'll just code up a
> little C++/ODBC app for them.)
> Thanks in advance,
> James
>|||See READTEXT and TEXTPTR commands in Books Online.
<bol>
READTEXT
Reads text, ntext, or image values from a text, ntext, or image column,
starting from a specified offset and reading the specified number of bytes.
Syntax
READTEXT { table.column text_ptr offset size } [ HOLDLOCK ]
...
Examples
This example reads the second through twenty-sixth characters of the pr_info
column in the pub_info table.
USE pubs
GO
DECLARE @.ptrval varbinary(16)
SELECT @.ptrval = TEXTPTR(pr_info)
FROM pub_info pr INNER JOIN publishers p
ON pr.pub_id = p.pub_id
AND p.pub_name = 'New Moon Books'
READTEXT pub_info.pr_info @.ptrval 1 25
GO
</bol>
"James Hunter Ross" <james.ross@.oneilsoft.com> wrote in message
news:upYfBsLKFHA.1280@.TK2MSFTNGP09.phx.gbl...
> Friends, I'd like to examine bytes 40 through 47 of a very large IMAGE
> field in records in one table. I'd like to handle the bytes as text if
> possible. A simple litle utility is needed by our customer, so I had hoped
> to avoid doing the utility in C++, and thought maybe perhaps I could
> hanlde this all as a SQL script. (I looked around, and it doesn't appear
> SQL really lets you work with binary.)
> Any ideas will be greatly appreciated. (Otherwise, I'll just code up a
> little C++/ODBC app for them.)
> Thanks in advance,
> James
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment