Hi
I would like to convert datatype Varchar to Integer.
Thanks for your help.
Man
convert Varchar to Integer
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The first thing to observe is that not every VarChar can be converted to Integer, so you probably need to use an IsValid() function to test whether the string you have is a valid integer. That done, there are a couple of ways you could effect the conversion, for example StringToDecimal() with the Decimal data type having a scale of 0, or AsInteger(). Is your VarChar nullable? If so you may also need to handle nulls.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.