I have the records in the database like this which are as follows. I want to search in the Account Column which is my last column in my AccountDetails Table. I want to searching based on conditions like
1- want to findt hose records which contain a hyphen after 1st number (which can be anything)
12- want to find those records which contain a hyphen after 2nd number (which can be anything)
123-want to find those records which contain a hyphen after 3rd number (which can be anything)
AccountDetail Table
230263 jba 100-1807
230263 jba 100-1808
230263 jba 100-1809
235572 jba 99-1818
235572 jba 99-1819
235572 jba 99-1820
235572 jba 9-1818
235572 jba 9-1819
235572 jba 9-1820
I have done like this
Select * From WF_Account Where CompanyId = 'jba' and Account Like '%-%'
Not sure which version of sql you are running.
but in SQL Server you can use
CHARINDEXor in sql 2012FINDSTRINGe.g
EDIT:
You can also use
PATINDEXwhich returns the position of string for a pattern.so maybe: