select currentyearcooperative,case CHARINDEX('-', currentyearcooperative) when 0 then currentyearcooperative else SUBSTRING(currentyearcooperative, 1, CHARINDEX('-', currentyearcooperative) - 1) end FarmerCoNo,
case CHARINDEX('-', currentyearcooperative) when 0 then currentyearcooperative else SUBSTRING(currentyearcooperative, CHARINDEX('-', currentyearcooperative) + 1, LEN(currentyearcooperative)) end FarmerCoName
from tbl_farmerregistration_ivorycoast where farmersapcode = '1147215'
When i run the above i get output as follows
currentyearcooperative FarmerCoNO FarmerCoName
FANYOUDALA(DIAWALA) FANYOUDALA (DIAWALA) FANYOUDALA (DIAWALA)
From the above i want output as follows
currentyearcooperative FarmerCoNO FarmerCoName
FANYOUDALA(DIAWALA) FANYOUDALA FANYOUDALA
i want to display the first 10 characters of FarmerCoNo and FarmerCoName.
from the above sql query what changes i have to made to get my above output.