Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A very unique situation
Message
From
04/02/2014 14:07:44
 
 
To
04/02/2014 00:09:58
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01593091
Message ID:
01593190
Views:
26
The following will avoid having to deal with a long WHERE IN clause as it will dump everything into #Temp and use it after to get the final SQL select command with all the fields that are needed.

This example includes a sample example of collecting 9 keys. But, in real life, this would be a bunch of conditions to determine which keys I need to collect.
SELECT Country.Numero INTO #Temp FROM Country WHERE Numero<10
SELECT Country.Title_E,Country.Title_F FROM Country WHERE Numero IN (SELECT * FROM #Temp)
The example shown above is just to demonstrate the approach. In real life, we have some very complicated SQL select commands but could use the same approach so to only collect the primary keys at first and then a simple select to get the rest of the fields.

Is this pretty much a considered optimized approach to handle that situation?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform