From: Erland Sommarskog on
odeddror (odeddror(a)cox.net) writes:
> Thank you very much it works just fine but I found out that this is not
> Char(13)
> This is the little square look like this []
> What is the Ascii char for this one?

It sound like you are describing the generic fallback glyph which is used
to present characters missing from the font. That is, it could be a non-
printing character, but it could also be a character from a script,
for instance Chinese, which is not in your font.

You can use the ASCII function to determine the character code.


--
Erland Sommarskog, SQL Server MVP, esquel(a)sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

From: Jeroen Mostert on
On 2010-06-20 11:44, Erland Sommarskog wrote:
> odeddror (odeddror(a)cox.net) writes:
>> Thank you very much it works just fine but I found out that this is not
>> Char(13)
>> This is the little square look like this []
>> What is the Ascii char for this one?
>
> It sound like you are describing the generic fallback glyph which is used
> to present characters missing from the font. That is, it could be a non-
> printing character, but it could also be a character from a script,
> for instance Chinese, which is not in your font.
>
> You can use the ASCII function to determine the character code.
>
>
As its name implies (and even then being inaccurate), the ASCII function can
only determine the character code of characters in a (VAR)CHAR expression,
and it can only return values in the range 0-255. For example, ASCII(N'Ĉ')
yields 67, the code for capital C, because the expression is first converted
to CHAR. You want UNICODE for characters that cannot be represented in a CHAR.

That is of course assuming it really would be something like Chinese; it's
quite likely it's a control character and then ASCII works fine.

--
J.
From: Jeroen Mostert on
On 2010-06-20 12:03, Jeroen Mostert wrote:
> On 2010-06-20 11:44, Erland Sommarskog wrote:
>> odeddror (odeddror(a)cox.net) writes:
>>> Thank you very much it works just fine but I found out that this is not
>>> Char(13)
>>> This is the little square look like this []
>>> What is the Ascii char for this one?
>>
>> It sound like you are describing the generic fallback glyph which is used
>> to present characters missing from the font. That is, it could be a non-
>> printing character, but it could also be a character from a script,
>> for instance Chinese, which is not in your font.
>>
>> You can use the ASCII function to determine the character code.
>>
>>
> As its name implies (and even then being inaccurate), the ASCII function
> can only determine the character code of characters in a (VAR)CHAR
> expression, and it can only return values in the range 0-255. For
> example, ASCII(N'Ĉ') yields 67, the code for capital C, because the
> expression is first converted to CHAR.

I of course immediately need to qualify this by saying that the result
actually depends on the collation in use. If your collation is one that
contains Ĉ as a character with a code point in the range 0-255, ASCII is
going to give the correct result. The result has actually little to nothing
to do with ASCII, but that's another matter.

--
J.
From: Erland Sommarskog on
Jeroen Mostert (jmostert(a)xs4all.nl) writes:
> As its name implies (and even then being inaccurate), the ASCII function
> can only determine the character code of characters in a (VAR)CHAR
> expression, and it can only return values in the range 0-255. For
> example, ASCII(N'?') yields 67, the code for capital C, because the
> expression is first converted to CHAR. You want UNICODE for characters
> that cannot be represented in a CHAR.

Yeah, since odeddror had nvarchar, using Unicode() is a better choice,
although judging from what he is doing, the unexpected character is probably
a control character.


--
Erland Sommarskog, SQL Server MVP, esquel(a)sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

From: odeddror on
Erland,

select ascii(' ') as CharacterCode

When I run this in SQL I'm getting Char(11) but I know it should be Char(13)
(this symbol should be small square like ascii 255)

Thanks,
Ed Dror


"Erland Sommarskog" <esquel(a)sommarskog.se> wrote in message
news:Xns9D9D9E5971199Yazorman(a)127.0.0.1...
> Jeroen Mostert (jmostert(a)xs4all.nl) writes:
>> As its name implies (and even then being inaccurate), the ASCII function
>> can only determine the character code of characters in a (VAR)CHAR
>> expression, and it can only return values in the range 0-255. For
>> example, ASCII(N'?') yields 67, the code for capital C, because the
>> expression is first converted to CHAR. You want UNICODE for characters
>> that cannot be represented in a CHAR.
>
> Yeah, since odeddror had nvarchar, using Unicode() is a better choice,
> although judging from what he is doing, the unexpected character is
> probably
> a control character.
>
>
> --
> Erland Sommarskog, SQL Server MVP, esquel(a)sommarskog.se
>
> Links for SQL Server Books Online:
> SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
> SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
> SQL 2000:
> http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
>