Skip to content
Advertisement

SQL mixed String with leading zeros

I want to get the maximum value of a table and then add that with +1. The problem here is that the column contains leading zeros and the length of the column cannot be greater than 4.

Here an example:

Tablename: car

id
C001
C002
C009

I have tried to solve this problem with this sql Query:

result: C0010 The problem with this query is that if C009 is the largest entry, the query should return C010. With this query, however, it returns C0010.

Advertisement

Answer

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement