Quote:
Originally Posted by elitemember21
I would like to ask about database here.
Let's just say i've added a datatype in DBManager in the source which is
SQL_PARAM_INPUT, SQL_C_LONG, SQL_VARCHAR
and i wrote a datatype INT in my Character_TBL
Is there gonna be a problem about the saving of data?
|
Of course there will be a problem or at least undefined behaviour can occur.
value2 works because SQL Server can interpret parts of the string as a number (which depends on how long that varchar is defined), but as soon as I would define it as 'varchar(4)', it won't work anymore, because it had to parse the 'a', which is not an integer.
Same goes for value3.
As long as your input is just numeric/integer, that could work out well. But you want your application to be consistent, so your types should be consistent too.
So: Better use 'SQL_INTEGER' or 'SQL_BIGINT' for the parameter binding to ensure your data is put into the database as intended.