select * form mydb where keyword = N''chicago''

解决方案 »

  1.   

    左手,我在查询分析器里试了一下,是错的,为什么要用两个双引号呢
    Line 1: Incorrect syntax near 'chicago'.
      

  2.   

    try:
    select * form mydb where keyword = 'chicago'
      

  3.   

    我运行了下面的代码,可以啊。
    create table nvar_tbl
    (
    var1 nvarchar(20)
    )insert into nvar_tbl values('tt1')
    insert into nvar_tbl values('tt2')
    insert into nvar_tbl values('tt33')
    insert into nvar_tbl values('tt4')
    insert into nvar_tbl values('tt51')select * from nvar_tbl where var1=N'tt1'
    select * from nvar_tbl where var1='tt1'如果上面的句子在你那里不行,那可能是查询分析器的环境参数设置问题,那得问大力,邹建,马可等高手了。
      

  4.   

    不是N的问题,按理说unicode的常量字符串是应该带N的,而且我正是因为以前就检索不出来,才加了N试试看的
    而且很奇怪的是,我手动insert进去的是能检索出来的,程序添加的就检索不出来,不过刚才我在查询分析器里
    试了一下select * from mydb where key = ltrim(rtrim(N'
    chicago
    '))就可以检索出来,但写到一行去就检索不出来,太奇怪了,我还要用程序检索呢,这可真麻烦