NVARCHAR和varchar
(1)
create table test (id int,name varchar(20))
insert into test select 1,'你好吗'
select * from test where name like '%好%'
(2)
create table test (id int,name nvarchar(20))
insert into test select 1,n'你好吗'
select * from test where name like n'%好%'
--------------------------------
不管表定义的是什么格式(是varchar或者nvarchar),在查询时加N和不加N都可以查询到呢,感觉都无所谓。。。
不过有一点很奇怪,我在我们公司的服务器上查询服务器上的一个ERP系统所用的数据库其中一个表时(表里字段定义的是nvarchar格式),此时我用 n'查询条件' 时确是查不到数据。
有高手可以帮下偶吗