what would cause my transmission to shift sometime and not at other time? on 1993 GMC Vandura 3500

my transmission shift sometime rough and other time it will not get out of second gear.

2 answers
Detent cable adjustment.
Dii you check for codes in the computer???