I test again in sql server 2005: 1. SELECT * FROM dbo.employee where Name >= '王' ------- OK 2. SELECT * FROM dbo.employee where Name >= NCHAR(29579) ------- OK 3. SELECT * FROM dbo.employee where Name <= '玌' ------- The RESULT is ERROR 4. SELECT * FROM dbo.employee where Name <= NCHAR(29580) ------- The RESULT is ERROR 5. SELECT * FROM dbo.employee where unicode(Name) <= 29580 ------- OK 6. SELECT * FROM dbo.employee where Name >= '王' and Name <= NCHAR(29580) ------- The RESULT is ERROR
The test case above let me confusion, maybe '玌' is not a real character. On Jun 27, 1:09 am, Thomas Mueller <[email protected]> wrote: > Hi, > > Yes, H2 converts LIKE 'a%' to BETWEEN 'a' AND 'b'. According to my > test this should work, as the Unicode character code for 王 is 29579, > and the code for 玌 is 29580. I wonder why it doesn't work for MS SQL > Server 2005. What happens if you run the query in MS SQL Server? What > happens if you only use name>=@P0 or only name<=@P1? > > Regards, > Thomas > > > > > > > > On Wed, Jun 22, 2011 at 4:52 AM, founder <[email protected]> wrote: > > I use h2-1.3.156.jar to testlinkedtableof sqlserver 2005. when > > execute query: [select * from LINK_TABLE where Name like '王%'], it > > returns nothing. Then I use SQL Server Profiler, the SQL run in the > > database is: [exec sp_prepexec @p1 output,N'@P0 nvarchar(4000),@P1 > > nvarchar(4000)',N'SELECT * FROM dbo.employee T WHERE name>=@P0 AND > > name<=@P1',N'王',N'玌']. > > > I search the forum and found same problem in [http://groups.google.com/ > > group/h2-database/browse_thread/thread/3c0167757fcbfc58/ > > d8bdf38605e6b197?lnk=gst&q=like#d8bdf38605e6b197] > > > -- > > You received this message because you are subscribed to the Google Groups > > "H2 Database" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group > > athttp://groups.google.com/group/h2-database?hl=en. -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
