Expressions – Agile BI http://agilebi.com A community for sharing ideas about business intelligence development using agile methods. Tue, 30 Aug 2011 15:45:00 +0000 en-US hourly 1 https://wordpress.org/?v=6.2.2 Checking Whether a Character is Numeric http://agilebi.com/blog/2011/08/30/checking-whether-a-character-is-numeric/ Tue, 30 Aug 2011 15:45:00 +0000 http://6.1517 Continue reading ]]> In SSIS, checking whether a value is numeric has always been a bit painful. Unfortunately, the SSIS expression language doesn’t have an IsNumeric function. Jamie Thomson (blog | twitter) has a nice post here that explains one way to do this check in a script component.

However, there is a shortcut you can take if you only need to check a specific character to see if it’s numeric. You can use the following expression:

FINDSTRING("0123456789", [CharacterToCheck], 1) != 0

If this returns True, the character is numeric. False means it’s not numeric.

This works by checking for the existence of the character in the string that contains all the numeric characters. If it finds an occurrence, then the character must be numeric. Obviously, this has some limitations over a real IsNumeric function, but if you just need to check single characters, it’s a lot faster than writing a script.

]]>