This will affect your credit rating although it's not as bad as a foreclosure would.
It does depend on the bank and the situation. Not every bank will ask you to cover the the difference. However, there some that will. Be prepared for that possibility. Good luck!