View Single Post

   
  #2 (permalink)  
Old 02-29-2008, 07:05 PM
Erland Sommarskog
 
Posts: n/a
Default Re: Literal value with "IN" clause

John Smith (genericemailaccount@genericdomain.genericTLD) writes:
> Is it okay to use a literal value with the IN clause. E.g.
>
> SELECT somefield, anotherfield
> ....
> WHERE ...etc.
> AND 1234 IN (SELECT userid FROM tblUsers)
>
> I was told it wasn't valid, but I'm pretty sure it worked for me. Just
> seeking clarification.


That should be OK. A bit unusual maybe, but certainly valid.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Reply With Quote