Other API
chm.ToHex
This function converts an array of bytes to hex characters and joins them using the given separator.
CREATE FUNCTION [chm].[ToHex]
(
@bytes VARBINARY(MAX),
@separaor NCHAR(1)
)
RETURNS NVARCHAR (MAX)
Example:
declare @bytes varbinary(3)
set @bytes = 0x1af45a
select chm.ToHex(@bytes, null)
chm.FromHex
This function converts a hex string into an array of bytes or varbinary(max) in T-SQL
.
CREATE FUNCTION [chm].[FromHex]
(
@str NVARCHAR(MAX)
)
RETURNS VARBINARY (MAX)
Example:
select chm.FromHex('1af45a') -- 0x1AF45A