954,535 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

SQL Gives Data Type Mismatch in Criteria Expression

I've had this problem many, many times. And it's always turned out to be a small typo or "" around an integer, but I just cannot find what's wrong with my SQL Statement this time!

SELECT Card_ID FROM Payment WHERE Customer_ID = 12 AND Card_Number = 1231231231231231

The table and fields are named correctly (the table is actually a query).

The only thing I can think of is the card number being too large, however it works fine in my INSERT INTO statement!
All of the fields are formatted as their respective data types, ie. Integers are set to integer, not string.

Any help is much appreciated!

Formby
Newbie Poster
10 posts since Apr 2011
Reputation Points: 10
Solved Threads: 0
 

Change column type to BigInt.

__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

You mean to say this number 1231231231231231 is being stored in an integer field in the database ?

debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 
You mean to say this number 1231231231231231 is being stored in an integer field in the database ?

Ahh, I think I've just figured it out. It's stored as a String, therefore it needs quotes around my value! Thanks for the help!

Formby
Newbie Poster
10 posts since Apr 2011
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: