declare @chr varchar(4) = 'yasi';
declare @bin varbinary(4) = convert(varbinary(20), @chr);
select
	@bin bin
,	CONVERT(varchar(4), @bin, 0) style0
,	CONVERT(varchar(4), @bin, 1) style1
,	CONVERT(varchar(4), @bin, 2) sytel2
/*
bin        style0 style1 sytel2
---------- ------ ------ ------
0x79617369 yasi   0x79   7961

참고: sys.fn_varbintohexstr
*/

문자열 형태의 바이너리(16진수)를 바이너리로 변경하기
declare @str_bin varchar(20)
set @str_bin = '00E5A473'
select convert(binary(4), '0x'+@str_bin, 1)

/* 결과
0x00E5A473
*/
Retrieved from http://w.databaser.net/moniwiki/wiki.php/CONVERTFunction
last modified 2018-04-13 23:12:54