To convert an int to a char, just use the following statement:

char c = (char) 134;

 

 You can cast integer to char directly. Is this what you need? 


-----Original Message-----
From: John English <[email protected]>
To: [email protected]
Sent: Thu, Mar 17, 2011 6:00 pm
Subject: Re: Inserting control characters in SQL


On 14/03/2011 09:26, Bruce Wen wrote: 
> If indeed necessary to insert one control character, you need insert the 
> int value (ASCII code) of the control character, I think. Of course, the 
> column's data type should be int or tinyint. 
 
No, it's a control character embedded in a string. I've ended up having 
to define a function in Java to convert an int to a char for lack of a 
better idea, but I'm amazed that there isn't a built-in function for 
this. 
 
------------------------------------------------------------------------ 
 John English | My old University of Brighton home page is still here: 
              | http://www.it.brighton.ac.uk/staff/je 
------------------------------------------------------------------------ 

 

Reply via email to