declare @t table (text1 varchar(3), text2 nvarchar(3))
insert into @t values('魔兽',N'魔兽')
--insert into @t values('魔兽','魔兽') --不加N存进去是乱码,并不会因为定义了Nvarchar就自动转换为Unicode
select * from @t where text2 = N'魔兽' --能查到
select * from @t where text2 = '魔兽' --不能查到 --无论加不加N'都能查到
declare @t table (text1 varchar(3), text2 nvarchar(3))
insert into @t values('123','123')
select * from @t where text2 = N'123' --能查到
select * from @t where text2 = '123' --能查到 --无论加不加N'都能查到
--总结:对于英文存入是为N' 但是select时不论加不加N'都能倒插
--总结:对于中文存入是为N' 但是select时有区别