Conversion from String to Integer
aaa
July 28th, 2011 1:40pm

Hello , I want to convert a String To integert to do some calculation.EmpPro field has Datatype Char(7) and I want to convert to integer. Table 1 EmpPro G29ABC2 I want to convert EmpPro data type from String to Integer. Can someone help with an answer. Thank you. G29ABC2 ??? you want to convert this to an integer ? any logic you have could you tell us what exactly integer converted value you are expecting from this value ... as there isnt any standard function available if u'll go for casting it will throw and error .... Hope that helps ... Kunal
Free Windows Admin Tool Kit Click here and download it now
July 28th, 2011 1:55pm

Hi I guess you are in wrong forum. Your question should be in Tsql forum. (Correct me if i am wrong) But if you just want to convert then you can use CAST or CONVERT. SELECT CAST(EmpPro AS INT) FROM Table SELECT CONVERT(INT, EmpPro) FROM Table
July 28th, 2011 1:57pm

Even in T_SQL forum this will not work because of the character values. We need a logic for converting.
Free Windows Admin Tool Kit Click here and download it now
July 28th, 2011 2:26pm

You can get the ASCII value for each character and cast it to INT. Or if you have any kind of bussiness logic...Chiran
July 28th, 2011 2:41pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics