SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Trying to use the IN List
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

tranquilraven
Starting Member

19 Posts

Posted - 06/08/2012 :  11:13:16  Show Profile  Reply with Quote
But I keep getting an error saying Your SQL is invalid: An expression of non-boolean type specified in a context where a condition is expected, near 'Code'.


Huh? I really, really want to understand this. Can someone please help explain what I am doing wrong, here is the code:


SELECT ProductCode, ProductPrice, ProductWeight
FROM Products
Where Product Code IN (RP2000,RP600,RP800,RP1000,F2000C,F1500C,F1000C,F700C,F600C,SFS2000,SFS1000,SFS600,F400C,RP400);
ORDER BY ProductCode

Lamprey
Flowing Fount of Yak Knowledge

3833 Posts

Posted - 06/08/2012 :  11:14:58  Show Profile  Reply with Quote
Perhaps the values in your IN clause are actualy strings and need to be enclosed in single quotes?

Edited by - Lamprey on 06/08/2012 11:15:11
Go to Top of Page

khtan
In (Som, Ni, Yak)

Singapore
16746 Posts

Posted - 06/08/2012 :  11:16:45  Show Profile  Reply with Quote

Where ProductCode IN ('RP2000', 'RP600', 'RP800', 'RP1000', 'F2000C', 'F1500C', 
                                 'F1000C', 'F700C', 'F600C', 'SFS2000', 'SFS1000', 'SFS600', 'F400C', 'RP400');
ORDER BY ProductCode



KH
Time is always against us

Go to Top of Page

tranquilraven
Starting Member

19 Posts

Posted - 06/08/2012 :  11:17:00  Show Profile  Reply with Quote
Nope same error.


quote:
Originally posted by Lamprey

Perhaps the values in your IN clause are actualy strings and need to be enclosed in single quotes?

Go to Top of Page

tranquilraven
Starting Member

19 Posts

Posted - 06/08/2012 :  11:19:30  Show Profile  Reply with Quote
LOL. Thank you both, you were both right. I misspelled ProductCode and I needed the quotes. Bless you both.


quote:
Originally posted by khtan


Where ProductCode IN ('RP2000', 'RP600', 'RP800', 'RP1000', 'F2000C', 'F1500C', 
                                 'F1000C', 'F700C', 'F600C', 'SFS2000', 'SFS1000', 'SFS600', 'F400C', 'RP400');
ORDER BY ProductCode



KH
Time is always against us



Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.11 seconds. Powered By: Snitz Forums 2000