I am working with a table that has a "company code" column that is char (10), but is always a number, sometimes padded to the left, sometimes to the right and not otherwise formatted.
I need to return the first whole number (no matter what it might be) that is not in that column.
So if my company codes already used are '1','2','3','4','5','15','
16','17','
18' ... I need to return 6 as a numeric
Is there a single query that can do this?
Start Free Trial