Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Including child member in master SQL
Message
De
09/10/2013 21:10:14
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01585152
Message ID:
01585154
Vues:
31
>So, what do you pass for all master rows? Suppose 0 means give me all Master records, your SQL will be
>
>select TW.Numero from Teamwork TW where @Param = 0 OR exists (select 1 from TeamWorkMember TWM where TWM.NoTeamWork = TW.Numero and TWM.NoMember = @Param) OPTION (recompile)
>
>OPTION (RECOMPILE) is important and will produce good plan in case you're using SQL 2008 R2 and up.
>
>Otherwise you may want to create dynamic SQL.

Thanks, I shall take a look at that. For now, I have simply put a condition to include this OUTER APPLY only when needed.
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform