Embarrassingly Simple SQL Server query: List Even numbers in....

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
7 replies · 3K views
Messages
7,822
Reaction score
13,151
Hi,
I am trying to find all the even numbers in [FieldName] in SQL Server.

My query is : SELECT [FieldName] FROM Table WHERE [FieldName] % 2 =0 ;

I only get an error message . ( I am using SQL Zoo, since I don't have SQL server available at the moment.

Only message I get is that the query is incorrect. I am trying to avoid using T-Sql, variables, etc.
 
Physics news on Phys.org
Last edited:
  • Like
Likes   Reactions: WWGD
jedishrfu said:
Could it be evaluating the query as?
SQL:
SELECT [FieldName] FROM Table WHERE [FieldName]  =0 ;

where the %2 has been removed.
I don't think so, since [FieldName] is the primary key. There may be a bug in the server or the (client) computer.
 
Last edited:
WWGD said:
I don't think so, since [FieldName] is the primary key. There may be a bug in the server or the (client) computer.
Thanks for the effort, though, a tough one.