Re: convert unicode to ansi

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Ivan Arjentinski (jarj11_at_hotmail.com)
Date: 05/09/04


Date: Sun, 9 May 2004 12:43:48 +0300

Hi,

If I understand correctly you are having problem sending unicode query from
your environment. You might try using NCHAR function to create queries which
are code page insensitive.

SELECT *
FROM table1
WHERE field1=NCHAR(5050) + NCHAR(6532) ...

Research also the UNICODE function which is the reverse of NCHAR.

Regards,
Ivan

"Kyriacos Michael" <kyrmich@XXXbadfan.comXXX> wrote in message
news:OJXYqMaNEHA.268@TK2MSFTNGP11.phx.gbl...
> I am having problems using ANSI encoding to query a unicode database that
is
> storing greek.
>
> from Query Analyzer:
> create table table1 (field1 nvarchar(10))
> insert into table1 select N'psi' --where psi is some greek characters
> select * from table1 where field1='psi' -- no results which is fine
> select * from table1 where field1=N'psi' -- 1 row
>
> by using PHP queries (ANSI):
> select * from table1 where field1='psi' -- no results
> select * from table1 where field1=N'psi' -- no results
> select * from table1 where field1 collate Greek_CI_AS = 'psi' -- no
results
> select * from table1 where field1 collate Greek_CI_AS = 'psi' collate
> Greek_CI_AS -- no results
> select * from table1 where convert(varchar(10), field1 collate
Greek_CI_AS)
> = 'psi' collate Greek_CI_AS -- no results
>
> The "problem" is that php sends "psi" character as ascii(248) to sql
server.
> My questions is:
> Can can I force sql server to convert a unicode character to an ansi one
> based on a given codepage, to workaround this problem?
>
> Thanks a lot
>
>



Relevant Pages

  • Re: Unicode Performance After Converstion
    ... The queries are just used to demonstrate the increased time to return ... data in the unicode database. ... of extra time as my simple Query Analyzer examples. ... meaning SQL Server must access twice as many pages to generate ...
    (microsoft.public.sqlserver.server)
  • Re: Query output is always in UNICODE... need ANSI ... Help?
    ... > I'm using XP_Sendmail stored procedure to run a query and mail the ... > UNICODE and the application that subsequently consumes the attachment ... > unmodified attachment in ANSI format makes the application all happy ...
    (microsoft.public.sqlserver.programming)
  • Re: Query output is always in UNICODE... need ANSI ... Help?
    ... > I'm using XP_Sendmail stored procedure to run a query and mail the ... > UNICODE and the application that subsequently consumes the attachment ... > unmodified attachment in ANSI format makes the application all happy ...
    (microsoft.public.sqlserver)
  • Query output is always in UNICODE... need ANSI ... Help?
    ... I'm using XP_Sendmail stored procedure to run a query and mail the ... UNICODE and the application that subsequently consumes the attachment ... unmodified attachment in ANSI format makes the application all happy ...
    (microsoft.public.sqlserver)
  • Query output is always in UNICODE... need ANSI ... Help?
    ... I'm using XP_Sendmail stored procedure to run a query and mail the ... UNICODE and the application that subsequently consumes the attachment ... unmodified attachment in ANSI format makes the application all happy ...
    (microsoft.public.sqlserver.programming)