FilChi Weblog

comparing values of different column types in mssql and mysql

Posted on: September 27, 2007


I was debugging this SQL statement in MSSQL and it says

“Syntax error converting the varchar value ‘LDI ‘ to a column of data type int. ”

I realized that this was due to the part where in the “Where” clause that compares the value of a char column with an integer, like for example,

agent_code = 942,

when it should be

agent_code = '942'

unlike,

where in mysql,
I could just compare the column with a value regardless of its type.
It could be already a known common difference between MSSQL and MySQL when comparing column values of different types, but I guess I just have to blog about it.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: