I have two tables.
One with int as primary key and other with a varchar primary key.
When an empty string is inserted ( "" ) i get programming error for int but successfully stores for varchar.
How does this work?
Is there a way to make varchar fields not accept empty strings?
I want them to give some database error which i can catch.
When a empty string is inserted ( "" ) i get programming error for int
Because a string is not an
int. And there's no way to automatically convert a non-numeric string to an
but successfully stores for varchar
Because a string is a
varchar. Columns like
VARCHAR are for storing character data, which is what a string is.
None of these values are
NULL is the absence of a value. An empty string is still a value.