Len和DataLength

create table #tmp1(id int,productname varchar(100))

insert into #tmp1
select 1,'aaaaa'
union
select 2,'中华人民共和国'

select id,productname,len(productname),datalength(productname) from #tmp1


create table #tmp2(id int,productname nvarchar(100))

insert into #tmp2
select 1,'aaaaa'
union
select 2,'中华人民共和国'

select id,productname,len(productname),datalength(productname) from #tmp2

drop table #tmp1
drop table #tmp2


go


declare @a table(a varchar(10),b nvarchar(10))

insert into @a(a,b)
select '中华','中华'
union
select 'aa','aa'

select a,b from @a

select a,len(a),b,len(b) from @a

select a,datalength(a),b,datalength(b) from @a

你可能感兴趣的:(Len和DataLength)