Kerberos
Kerberos

Reputation: 1266

How to add specific string to existing string in SQLite?

My column pattern as below.

<3CHARS>:<3CHARS>:<3CHARS>:1-<Not-Static-String> 

<3CHARS>:<3CHARS>:<3CHARS>:7-<Not-Static-String> 

etc...

I would like to insert 0 before 1 like this;

<3CHARS>:<3CHARS>:<3CHARS>:01-<Not-Static-String> 

<3CHARS>:<3CHARS>:<3CHARS>:07-<Not-Static-String> 

I have tried to use CONCAT but didn't write correct SQL

Upvotes: 0

Views: 50

Answers (1)

Googie
Googie

Reputation: 6017

UPDATE tableName
   SET columnName = substr(columnName, 1, 12) || '0' || substr(columnName, 13);

Upvotes: 1

Related Questions