I have a table called tbenc
. Want to insert a value in the Name
column which should be hash encrypted using hashbytes()
T-SQL function.
create table tbenc
(
Id int not null identity,
Name varchar(300) null,
)
declare @var nvarchar(200)
select @var = hashbytes('sha1', 'Nora')
print @var
insert into tbenc values(@var)
When I run:
select * from tbenc
It shows ?-s instead of the hash code.
Can anyone point out my mistake? Thanks in advance.
You need to use varbinary :
declare @var varbinary(200)
select @var = hashbytes('sha1', 'Nora')
print @var;