Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Server INLIST ()
Message
From
04/11/2006 05:08:38
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
03/11/2006 12:59:09
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01166962
Message ID:
01167086
Views:
9
>I need to build a SQL Server SELECT. I need to get data on a number of employees. In VFP I would have something like
>
> WHERE INLIST (employee_id, 3456, 8888, 6543)
>
>What do I do in SQL Server?
>
>
>Thanks.
>
>
>Tim

Tim,
For small and hardcoded lists:

where employee_id in (3456,8888, 6543)

However generally lists are longer and or you do not want to hardcode them. Then using a join is a better solution. To do that you either create a temp table and fill in or use an existing one from an external source such as a VFP table. Join approach is important if you're doing this say for a remote view in VFP (though you asked in MSSQL section). Check:
Re: Joining remote table with local cursor Thread #921514 Message #921530
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform