No wonder; nothing guarantees you that some random string value always holds correct representation of an integer value.
The whole idea put in your database schema is wrong. You either need to make your
department_id
a string uniquely identifying your department in required scope, not limiting it to integers, or use proper data type representing a numeric value. Anyway, you should never use string types where numeric data is required; it's both inefficient and unreliable.
See, for example,
https://msdn.microsoft.com/en-us/library/ms187745.aspx[
^].
—SA