When using the following command:
SELECT TOP 1000 [Code1]
I always get a 0 back from charindex even though all of the records have a hyphen in the code1 field. Code1 holds text like 38-765432 in each record. However, if I change the '-' to a number like '7' then the above code works fine.
Any suggestions on how I can get the position of the '-'.