A friend asked how in SQL to convert a varchar which represents an octal value into integer, so I’m placing an answer here and seeing if anyone improves upon it.
I had hoped for a solution that could be run inline as part of query, without having to create any function in the database (e.g if you only have permission to query a database, but not create any new functions or stored procedures in it).
Alternatively, I see that .Net Framework ToInt32 method has easy way of doing this, but seems like jumping through a lot of CLR integration hoops required to get there.
Somewhat convoluted – requiring a 2-level scalar subquery
Setup & Query
Results