Function:
[AdventureWorks2016CTP3].[dbo].[AUDIT_fn_HexToStr]
Name | Value |
Schema | [dbo] |
Owner | [dbo] |
Creation date | 21.09.2016 |
Type | Scalar |
Is schema bound | |
Is deterministic | |
Encrypted | |
Implementation type | Transact SQL |
ID | 120387498 |
Name | Value |
QUOTED_IDENTIFIER | ON |
ANSI_NULLS | ON |
Name | Description | DataType | Max length | ReadOnly |
@hex | varbinary | 8000 |
Name | Datatype | Max length |
@Return | varchar | 8000 |
Object name | Object type | Dep level |
[dbo].[AUDIT_fn_SqlVariantToString] | Function | 1 |
SET ANSI_NULLS ON SET QUOTED_IDENTIFIER ON GO create function [dbo].[AUDIT_fn_HexToStr](@hex varbinary(8000)) returns varchar(8000) as begin declare @len int, @counter int, @res varchar(8000), @string char(16), @byte binary(1) set @string = '0123456789ABCDEF' set @res = '0x' set @len = datalength(@hex) set @counter = 1 while(@counter <= @len) begin set @byte = substring(@hex, @counter, 1) set @res = @res + substring(@string, 1 + @byte/16, 1) + substring(@string, 1 + @byte - (@byte/16)*16, 1) set @counter = @counter + 1 end return @res end GO |