Character Conversion

Character Conversion

Post by Khurram Chaudhar » Wed, 03 Mar 2004 05:17:27



Hi,

I'm looking for simple way to convert a character to an integer through a
SP. For example, I want to convert A-Z to -26 to -1 where A would be -26, B
would be -25, and so on.

Is there an easy way to do this without a table? Also, how can I call this
SP from another SP?

Thanks.

Khurram

 
 
 

Character Conversion

Post by Scot » Wed, 03 Mar 2004 05:31:05


You can use the ASCII function to return the Base 10
numeric value of the character.  Then just adjust the
number up or down as needed

Try this:

SELECT ASCII('A')

ASCII is the reciprical of CHAR()

SELECT CHAR(ASCII('A'))

Quote:>-----Original Message-----
>Hi,

>I'm looking for simple way to convert a character to an
integer through a
>SP. For example, I want to convert A-Z to -26 to -1 where
A would be -26, B
>would be -25, and so on.

>Is there an easy way to do this without a table? Also,
how can I call this
>SP from another SP?

>Thanks.

>Khurram

>.


 
 
 

Character Conversion

Post by David Porta » Wed, 03 Mar 2004 16:39:26


SELECT ASCII('A')-91

--
David Portas
SQL Server MVP
--

 
 
 

1. SQLOLEDB, character conversion - Help!

I'm trying to use "Auto Translate" property of the SQLOLEDB provider to
OEM/ANSI character conversion. If this property is set to TRUE then I get
the wrong converted string. I need a cp866 to cp1251 conversion, but I get
something else.

My systems options is as follows:

Windows NT Server
                                            OEM CP: 866
                                            ANSI CP: 1251

SQL Server                        Default character set: cp866

Windows NT Workstation
                                            OEM CP: 866
                                            ANSI CP: 1251

Thank you

2. Preventing the triggers from firing..

3. JDBC - character conversion

4. running scripts at installation time

5. Strange Delphi 1.0 character conversion

6. Help HASH clusters oracle 7

7. Q: International characters conversion

8. NT3.51 Clients

9. Foreign character conversion when doing an import

10. Excalibur DataBlade Character Conversion Problem.

11. Subqueries and numeric to character conversion problem

12. Character conversion problem when sendiing data to a Mac

13. Japanese multibyte character conversion