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

Articles with tag T-SQL Rss

Search for any content tagged t-sql

<< Newer    Items 21 to 40 of 1154    Older >>
 

The "Numbers" or "Tally" Table: What it is and how it replaces a loop

Many people have used a "Numbers" or "Tally" table without really knowing what it does. This is an introduction as to how a Tally table replaces a loop.  Read more...
By Jeff Moden 2014/07/04 (first published: 2008/05/07) | Source: SQLServerCentral.com | Category: t-sql
Rating: |  Discuss |   Briefcase | 92,262 reads

Stairway to T-SQL: Beyond The Basics Level 7: Controlling the Flow of Your T-SQL

When you are writing TSQL code there are times when you want to perform the same logic over and over again. To accomplish this you can used the WHILE keyword. There are other times when you want to perform a conditional test and depending on the results of the test you execute one code block for the TRUE condition and possibly a different code block when the condition is FALSE. When you need to conditionally execute code based on the outcome of a condition you can used the IF keyword. In this Stairway level I will be discussing how to use the WHILE and IF constructs to control the flow of your TSQL code.  Read more...
By Gregory Larsen 2014/06/25 | Source: SQLServerCentral.com | Category: stairway series
Rating: |  Discuss |   Briefcase | 6,468 reads

How to Make Scalar UDFs Run Faster (SQL Spackle)

It's a well known fact that Scalar UDFs are the stuff of performance nightmares in T-SQL. But are they really as bad as they say? SQL Server MVP Jeff Moden shows us that they might not really be as big a problem as you might think and what you can do when they actually are.  Read more...
By Jeff Moden 2014/06/24 (first published: 2012/08/01) | Source: SQLServerCentral.com | Category: t-sql
Rating: |  Discuss |   Briefcase | 15,428 reads

The SQL of The Game of Life

Joe Celko finds a reference to Conway's Game of Life while clearing out his desk, and is suddenly gripped with nostalgia. It wasn't just flares, mullets and disco, but simple computer games in interpreted basic. Somehow, Conway's Game of Life was too intriguing to be abandoned in the attic. Can it be implemented in SQL? Joe sets up a challenge.  Read more...
By Additional Articles 2014/06/16 | Source: SimpleTalk | Category: modeling
Rating:  Rate this |   Briefcase | 2,417 reads

Find Customers Who Bought "A" and "B" But Not "C" (SQL Spackle)

A simple problem that can become complex in T-SQL. How do you find the rows that match 2 conditions, but not a third, in an efficient manner. MVP Jeff Moden gives us a solution.  Read more...
By Jeff Moden 2014/06/06 (first published: 2012/03/29) | Source: SQLServerCentral.com | Category: t-sql
Rating: |  Discuss |   Briefcase | 21,953 reads

T-SQL User-Defined Functions: Ten Questions You Were Too Shy To Ask

SQL Server User-Defined Functions are good to use in most circumstances, but there just a few questions that rarely get asked on the forums. It's a shame, because the answers to them tend to clear up some ingrained misconceptions about functions that can lead to problems, particularly with locking and performance  Read more...
By Additional Articles 2014/06/04 | Source: SimpleTalk | Category: t-sql
Rating: (not yet rated)  Rate this |   Briefcase | 6,240 reads

Cursor-Killing: Retrieving Recently Modified Data

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? In the next part of an ongoing series, we look at ways to efficiently retrieve recently modified data.  Read more...
By Edward Pollack 2014/06/02 | Source: SQLServerCentral.com | Category: cursor
Rating: |  Discuss |   Briefcase | 6,288 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: SQLServerCentral.com | Category: cte
Rating: |  Discuss |   Briefcase | 12,011 reads

Comparing Different Data Types

Comparing columns of different data types can be a drain on resources, as well as our sanity. This is a look into a few strategies for dealing with implicit conversions.  Read more...
By Edward Pollack 2014/05/19 | Source: SQLServerCentral.com | Category: data types
Rating: |  Discuss |   Briefcase | 6,168 reads

Cumulative sum of previous rows

I had an update statement that took 3 minutes to run after this code change it took 6 seconds.  Read more...
By Ben Kubicek 2014/05/08 | Source: SQLServerCentral.com | Category: cumulative
Rating: |  Discuss |   Briefcase | 10,940 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: SQLServerCentral.com | Category: duplicate
Rating: |  Discuss |   Briefcase | 6,339 reads

Unexpected View Performance

Views that use implicit conversion to return result sets may use a different query plan than the statement executed in query analyzer.  Read more...
By Thom Bolin 2014/04/18 (first published: 2011/01/11) | Source: SQLServerCentral.com | Category: views
Rating: |  Discuss |   Briefcase | 13,759 reads

Stairway to T-SQL: Beyond The Basics Level 6: Using the CASE Expression and IIF Function

There are times where you need to write a single T-SQL statement that is able to return different T-SQL expressions based on the evaluation of another expression. When you need this kind of functionality you can use the CASE expression or IIF function to meet this requirement. In this Stairway level Gregory Larsen reviews the CASE and IIF syntax and showing you examples of how the CASE expression and IIF function.  Read more...
By Gregory Larsen 2014/04/09 | Source: SQLServerCentral.com | Category: stairway series
Rating: |  Discuss |   Briefcase | 10,475 reads

Divide and Conquer - Performance Tuning

Sometimes we need to break down a complex problem into a multiple stage solution to achieve optimal performance  Read more...
By Claire Mora 2014/04/08 | Source: SQLServerCentral.com | Category: t-sql
Rating: |  Discuss |   Briefcase | 7,689 reads

Stairway to T-SQL: Beyond The Basics Level 5: Storing Data in Temporary Tables

There are times when retrieving data for complex business requirement requires you to temporarily store one or more results sets for a short period of time. Typically these temporary tables are stored in the scope of the current connection, but they may also need to be available across multiple connections.   Read more...
By Gregory Larsen 2014/04/02 | Source: SQLServerCentral.com | Category: stairway series
Rating: |  Discuss |   Briefcase | 9,040 reads

Using EXCEPT to Determine Row Differences

How to use the EXCEPT statement to perform row differences.  Read more...
By M. Douglas Bowan II 2014/03/25 | Source: SQLServerCentral.com | Category: except
Rating: |  Discuss |   Briefcase | 16,917 reads

On Handling Dates in SQL

The handling of dates in TSQL is complex - when SQL Server was Sybase, it was forced by the lack of prevailing standards in SQL to create its own ways of processing and formatting dates and times. Joe Celko looks forward to a future when it is possible to write standard SQL date-processing code with SQL Server.  Read more...
By Additional Articles 2014/03/21 | Source: SimpleTalk | Category: dates and conversion
Rating:  Rate this |   Briefcase | 6,576 reads

Stairway to T-SQL: Beyond The Basics Level 4: Using Views to Simplify Your Query

This level discusses how to use a database VIEW to simplify your Transact-SQL(T-SQL) code. By understanding how to use a VIEW you will be able to better support writing T-SQL code to meet complex business requirements. In this article I will be discussing what a database VIEW is and then providing a number of examples to help you understand how you can use a VIEW to implement different coding scenarios.  Read more...
By Gregory Larsen 2014/03/19 | Source: SQLServerCentral.com | Category: stairway series
Rating: |  Discuss |   Briefcase | 8,168 reads

Creating a Date Range from Multiple Rows Based on a Single Date

When you've got only a single effective date on a record and you need to artificially create the effective end date based on a following row in T-SQL, the techniques discussed in this article will help you decide what is best.  Read more...
By Dwain Camps 2014/03/18 | Source: SQLServerCentral.com | Category: t-sql
Rating: |  Discuss |   Briefcase | 7,270 reads

Having fun with PARSENAME (SQL Spackle)

PARSENAME is perhaps the most infrequently used built-in documented function in SQL Server. SQL Server Microsoft Certified Master Wayne Sheffield shows why this nifty function ought to be included in your SQL toolbox.  Read more...
By Wayne Sheffield 2014/03/17 | Source: SQLServerCentral.com | Category: parsename
Rating: |  Discuss |   Briefcase | 9,849 reads
<< Newer    Items 21 to 40 of 1154    Older >>