Click here to Skip to main content
15,899,754 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to use substring in sqlite but not is sqlite but i need in sqlite. How to use in another method.
SELECT SUBSTRING(AccountNo, 0, LEN(AccountNo)-(CHARINDEX('-', AccountNo) +1)) FROM account


What I have tried:

SELECT SUBSTRING(AccountNo, 0, LEN(AccountNo)-(CHARINDEX('-', AccountNo) +1)) FROM account

it is working on sql but error on SQLITE as
no such function: SUBSTRING: 
SELECT SUBSTRING(AccountNo, 0, LEN(AccountNo)-(CHARINDEX('-', AccountNo) +1)) FROM account
Posted
Updated 30-Dec-17 3:24am

1 solution

SQLite has a substr function, you can try that one. Aside from that, SQLite doesn't appear to have a CHARINDEX function, but instr should do the same job. SQLite Query Language: Core Functions[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900