Mike.. the parts are not fixed length.
Your first select is returning great results but the occasional '~' is on the end of some records.
B005739997706~
I added a replace on the SecondString.
select substring(docid,charindex('~',docid)+1,7)FirstString,
replace(substring(docid,CharIndex('~', docid, charindex('~',docid)+1 + 1) + 1, 7),'~','') SecondString
from mytable