var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Help! Scalar Function to Strip last Digit
Hello, I'm new to the DB2 SQL Syntax.
I am using DB2 Connect to query our AS400 database.
I am trying to select a numeric column and strip the last digit.
I've been playing with the scalar functions, but still do not understand which one to use to strip that last digit, which is serving as a check digit and must be stripped to perform a join correctly.
I need a simple SQL statement as one of the other tools I am using will not accept variables, etc.
The field is left padded with 0's so 281 = 0000281, datatype is Numeric 7,0
DB2 Connect Enterprise Edition
Originally Posted by soliver
This works on DB2 8.2 on Windows and doesn't depend on the length of the column c:
select substr(digits(c),1,length(digits(c))-1) from a
Hope this helps
I just tried the query and it works.