Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in

Content with tag CTE Rss

   Items 1 to 20 of 34    Older >>


This script is an example explaining how to write DML using CTE.  Read more...
By kbhanu15 2014/07/23 | Source: | Category: dml
Rating: |  Discuss |   Briefcase | 604 reads

Cursor-Killing: Accessing Data in the Next Row

Cursors are considered by many to be the bane of good T-SQL. What are the best ways to avoid iterative T-SQL and to write queries that look and perform beautifully? This first part in an ongoing series of cursor-killing handles inter-row analysis.  Read more...
By Edward Pollack 2014/05/27 | Source: | Category: cte
Rating: |  Discuss |   Briefcase | 11,429 reads

Duplicate Detection and Management

Inevitably, every DBA is eventually asked to delete, merge, or otherwise report on duplicate data. There are many tools at our disposal to make this task both simple and efficient to complete. Read on for simple steps and examples to effectively deal with duplicate data.  Read more...
By Edward Pollack 2014/04/29 | Source: | Category: duplicate
Rating: |  Discuss |   Briefcase | 6,214 reads

Standard Deviations with CTE in SQL

I was working with a client recently getting the number of standard deviations a student was off the average number...  Read more...
By MikeDavis 2014/02/27 | Source: SQLServerCentral Blogs | Category: blogs
Rating: (not yet rated) |  Discuss |   Briefcase | 1,605 reads

Nesting Levels in SQL

The 'Structured' part of SQL denotes the fact that queries can be nested inside each other in such a way that, wherever you can use a table, you can use a table expression. Such derived tables can provide powerful magic, to which is added CTEs and Lateral Tables.   Read more...
By Additional Articles 2014/02/11 | Source: SimpleTalk | Category: structure
Rating:  Rate this |   Briefcase | 3,932 reads

How to Compare Rows within Partitioned Sets to Find Overlapping Dates

How to Compare Rows within Partitioned Sets to Find Overlapping, Contiguous, or Gap dates  Read more...
By Kevin Wu 2013/12/25 (first published: 2010/10/11) | Source: | Category: cte
Rating: |  Discuss |   Briefcase | 6,913 reads


By Samith C 2013/09/25 | Category: cte
Rating: (not yet rated) |  Discuss |   Briefcase | 2,834 reads

Sales Report on a View

Sales Report based on a single view 
By Sergiu Ungureanu 2013/09/17 | Source: | Category: cte
Rating: |  Discuss |   Briefcase | 1,268 reads

Common table expressions and circular references

Finding circular references that are stopping your CTE from working.  Read more...
By Geoff Norman 2013/09/02 (first published: 2011/01/31) | Source: | Category: cte
Rating: |  Discuss |   Briefcase | 15,974 reads

Displaying Sorted Hierarchies (SQL Spackle)

Learn how you can query a hierarchy of data and also return the results in an ordered fashion. A handy T-SQL skill that you will use over and over again.  Read more...
By Jeff Moden 2013/08/23 (first published: 2011/03/10) | Source: | Category: t-sql
Rating: |  Discuss |   Briefcase | 16,472 reads

Virtual tally table function

An inline table-valued function (iTVF) that will produce a virtual tally table on-the-fly. The function creates a tally table of any size with user-defined lower and upper bounds.  Read more...
By Steven Willis 2013/07/23 | Source: | Category: tally
Rating: |  Discuss |   Briefcase | 1,093 reads

Generate N numbers

Reursive CTE Script to generate n numbers 
By Harsha Majety 2013/04/17 | Source: | Category: recursion
Rating: |  Discuss |   Briefcase | 1,362 reads

Multiple CTEs

Multiple CTEs It’s somewhat obscure in BOL and I wasn’t able to find any examples but it turns out you can...  Read more...
By Kenneth Fisher 2012/10/11 | Source: | Category: blogs
Rating: (not yet rated) |  Discuss |   Briefcase | 2,967 reads

Exploring Recursive CTEs by Example

Recursive CTEs can be confusing and scary, so examining some non-standard examples may cast light upon these shadowy demons.  Read more...
By Dwain Camps 2012/07/17 | Source: | Category: t-sql
Rating: |  Discuss |   Briefcase | 11,591 reads

Convert a string list to TABLE with single CTE query

Converts a string list into a table using a single query, no variables and no helper functions.  Read more...
By Dimitris Staikos 2012/05/11 | Source: | Category: cte
Rating: |  Discuss |   Briefcase | 2,161 reads

Pros and cons of six SQL table tools

This article shows how to use 6 SQL table-based tools to solve the same problem, and gives the pros and cons of each.  Read more...
By Andy Owl 2011/12/26 | Source: | Category: t-sql
Rating: |  Discuss |   Briefcase | 8,618 reads

Dealing with Incomplete Data - A T-SQL Puzzle 1

Client data received for processing may have invalid records based on processing requirements. Identifying and dealing with bad records in a specific scenario is the object of this article.  Read more...
By Suresh Maganti 2011/11/22 | Source: | Category: t-sql
Rating: |  Discuss |   Briefcase | 3,307 reads

Display multiple rows values as single row value (Different Columns)

Display multiple rows values as single row value in different rows (No Cursor).  Read more...
Rating: |  Discuss |   Briefcase | 2,918 reads

Calculating Stock Returns Using the ROW_NUMBER function and CTEs

In finance, when pricing data isn't available on last day of week, month or year, calculating returns is tricky. This article addresses the issue.   Read more...
By John Ryle 2011/10/18 | Source: | Category: common table expressions
Rating: |  Discuss |   Briefcase | 5,379 reads

Hidden RBAR: Counting with Recursive CTE's

"Counting" is essential to many high performance code techniques. SQL Server MVP, Jeff Moden, shows us how to make sure that we're "Counting" and not "Crippling" our trick-code.  Read more...
By Jeff Moden 2011/08/08 | Source: | Category: t-sql
Rating: |  Discuss |   Briefcase | 11,280 reads
   Items 1 to 20 of 34    Older >>
t-sql (21)    
recursion (8)    
row_number() (3)    
blogs (2)    
common table expression (2)    
cursor (2)    
tally table (2)    
common table expressions (1)    
counter (1)    
date manipulation (1)    
datediff (1)    
derived table (1)    
dml (1)    
duplicate (1)    
ema (1)    
hierarchy (1)    
holiday (1)    
howto (1)    
humor (1)    
ids to table (1)    
interstorm (1)    
lag (1)    
lateral tables (1)    
lead (1)    
list (1)    
loop (1)    
macd (1)    
merge (1)    
michael davis (1)    
moving average (1)    
mstvf (1)    
nested queries (1)    
output clause (1)    
partition (1)    
partitioned sets (1)    
pivot (1)    
recursive (1)    
search (1)    
sma (1)    
sql server 2005 (1)    
sql spackle (1)    
string manipulation (1)    
string to table (1)    
structure (1)    
table expression (1)    
table variables (1)    
table-valued function (1)    
tally (1)    
views (1)    
while (1)    
window function (1)