Page 1 of 1

convert Varchar to Integer

Posted: Sat Jul 07, 2012 4:54 pm
by mandyli
Hi

I would like to convert datatype Varchar to Integer.


Thanks for your help.

Man

Posted: Sat Jul 07, 2012 11:06 pm
by chulett
And?

Posted: Sun Jul 08, 2012 1:42 am
by ray.wurlod
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.

Posted: Sun Jul 08, 2012 2:32 pm
by mandyli
Thanks .

I will do it.

Thanks
Man