Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A very unique situation
Message
From
04/02/2014 14:21:24
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01593091
Message ID:
01593198
Views:
22
>I think you need to say where Numero IN (select Numero from #Temp)

It works in both ways. This is because #Temp only contains one field. But, for standardization, I have added Temp.Numero.
SELECT Numero INTO #Temp FROM Country WHERE Numero<10
SELECT * FROM Country WHERE Numero IN (SELECT #Temp.Numero FROM #Temp)
>Now, it may perform better for complex scenarios (e.g. selecting keys only into temp table first and then all info for these keys). In simple cases it may not give performance gain or may even be slower than original direct query without using a temp table.

Yes, I have applied a verification to detect which route to take. If the table has less than 1000 records, it goes as before. If it has more, it will use this approach.
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
Reply
Map
View

Click here to load this message in the networking platform