I am using a SQL Server 2012 and i have a table with following structures
DebCode,DebName,DebBillAdd1,DebBillAdd2,DebBillAdd3
But in my DebBillAdd1
column contains complete address of debtors like below.(DebBillAdd2
and DebBillAdd3
are empty for all records)
No170, Madapatha Road, Pillyandala, Sri Lanka
91/1, Canal Road, Hethdala, Wattala.
Now i need to split the address into 3 parts and update them in remaining DebBillAdd2 and DebBillAdd3 columns.
This is how i need the addresses to be split ted.
DebBillAdd1 - No170, Madapatha Road
DebBillAdd2 - Piliyandala
DebBillAdd3 - Sri Lanka
DebBillAdd1 - 91/1, Canel Road
DebBillAdd2 - Hethdala
DebBillAdd3 - Wattala
DebBillAdd1
- The SUBSTRING() has to retrieve the string between the 1st character and first two commas.DebBillAdd2
- The SUBSTRING() has to retrieve the string between the next two commasDebBillAdd3
- The SUBSTRING() has to retrieve the remaining string.
i am using Visual Foxpro for for development.
As i am not aware of splitting i could not make it out. Can you guys explain me on how to do this?