if OBJECTPROPERTY( OBJECT_ID( 'dbo.BinaryToIEEE32' ) , 'IsScalarFunction' ) is not null
drop function dbo.BinaryToIEEE32
GO
create function dbo.BinaryToIEEE32 (
@Bytes binary(4)
)
returns binary(4)
as
begin
/********************************************************************************/
/* Created By : Umachandar Jayachandran (UC) */
/* Created On : 28 July 2002 */
/* Description : Reverses byte sequence for IEEE 754 manipulation. */
/* This is required when using internal representation of the */
/* binary data for single-precision value. */
/* Ex: "BinaryData" column of the SQL Profiler stores real values*/
/* in this manner for show plan statistics event. */
/********************************************************************************/
/* Resources : https://umachandar.com/resources.htm */
/********************************************************************************/
return substring( @Bytes, 4, 1 ) + substring( @Bytes, 3, 1 ) +
substring( @Bytes, 2, 1 ) + substring( @Bytes, 1, 1 )
end
go
if OBJECTPROPERTY( OBJECT_ID( 'dbo.BinaryToIEEE64' ) , 'IsScalarFunction' ) is not null
drop function dbo.BinaryToIEEE64
GO
create function dbo.BinaryToIEEE64 (
@Bytes binary(8)
)
returns binary(8)
as
begin
/********************************************************************************/
/* Created By : Umachandar Jayachandran (UC) */
/* Created On : 28 July 2002 */
/* Description : Reverses byte sequence for IEEE 754 manipulation. */
/* This is required when using internal representation of the */
/* binary data for double-precision value. */
/* Ex: "BinaryData" column of the SQL Profiler stores real values*/
/* in this manner for show plan statistics event. */
/********************************************************************************/
/* Resources : https://umachandar.com/resources.htm */
/********************************************************************************/
return substring( @Bytes, 8, 1 ) + substring( @Bytes, 7, 1 ) +
substring( @Bytes, 6, 1 ) + substring( @Bytes, 5, 1 ) +
substring( @Bytes, 4, 1 ) + substring( @Bytes, 3, 1 ) +
substring( @Bytes, 2, 1 ) + substring( @Bytes, 1, 1 )
end
go
This page was last updated on May 01, 2006 04:28 PM.