Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL select problem
Message
De
19/02/2012 10:33:38
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Divers
Thread ID:
01535310
Message ID:
01535788
Vues:
36
>In this particular case it's the same as derived table. Using CTE makes the query easier to read. For the cons - don't use the same CTE more than once in a query, it can produce performance problems - I found it by experience.
>
>Some good blogs to read about cte:
>
>CTE: Coolest T-SQL Enhancement - Blog by Brad Schulz
>
>http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/sql-advent-2011-recap - summary blog by Denis Gobo (cte is day 5), you may find each day to be of interest
>
>And, of course, my own blog
>CTE and hierarchical queries


Thanks Naomi -- some good links there. I tried using the CTE in my query and it worked fine as far as returning the results I wanted. I don't have a lot of test data, but it's not a recursive query so I shouldn't have any performance problems.

I realize that CTE was introduced in SQL 2005, but I just haven't had the opportunity to use it (or need it) until now. But actually, if I had learned about it back in 2005, maybe I would have made more use of it! <g>

Thanks!
~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform