Use the 'datalength()' function:
create proc p
@b varbinary(10)
as
select datalength(@b)
HTH,
Rob
-------------------------------------------------------------
Rob Verschoor
Certified Sybase Professional DBA for ASE 12.5/12.0/11.5/11.0
and Replication Server 12.5
Author of various Sybase books. New book (coming soon): "The
Complete Sybase Replication Server Quick Reference Guide"
Online orders accepted at http://www.sypron.nl/shop
mailto:rob (AT) YOUR (DOT) SPAM.sypron.nl.NOT.FOR.ME
http://www.sypron.nl
Sypron B.V., P.O.Box 10695, 2501HR Den Haag, The Netherlands
-------------------------------------------------------------
"Matt Tyler" <matthew.tyler (AT) reuters (DOT) com> wrote
Quote:
Hi,
I have been tasked with updating some stored procedures that take a
varbinary type as input.
In order to reject invalid input I need to calculate the length in
bytes of a varbinary type (I also need to take account of any trailing
zeros).
I have searched this group and the web for a T-SQL method to perform
the above but have drawn a blank so far. Does anyone have any ideas.
Thanks
Matt |