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

   Items 1 to 20 of 1189    Older >>
 

Using a Recursive CTE to Generate a List

Learn how to generate lists of column values from multiple rows by grouping and using a recursive CTE. This is a very flexible and easy implementation, compared to using cursors or PIVOT operators.  Read more...
By Svetlana Marinova 2015/06/26 (first published: 2013/07/09) | Source: SQLServerCentral.com | Category: recursive cte
Rating: |  Discuss |   Briefcase | 19,994 reads

Writing Better T-SQL: Top-Down Design May Not be the Best Choice – Part II

A second part to the series by Mickey Stuewe on writing better T-SQL looks at some of the issues of using views in a complex query.  Read more...
By Mickey Stuewe 2015/06/23 | Source: SQLServerCentral.com | Category: t-sql
Rating: |  Discuss |   Briefcase | 7,520 reads

Reusing T-SQL Code

Alex Kuznetsov, in an article taken from his book 'Defensive Database Programming with SQL Server', shows how DRY principles can be put in practice with constraints, stored procedures, triggers, UDFs and indexes.  Read more...
By Additional Articles 2015/06/10 | Source: SimpleTalk | Category: t-sql
Rating: (not yet rated)  Rate this |   Briefcase | 5,138 reads

Query Performance Tuning – A Methodical Approach

Learn how to approach performance tuning in this piece from SQL Server MCM and MVP, Gail Shaw.  Read more...
By Gail Shaw 2015/06/08 | Source: SQLServerCentral.com | Category: performance and tuning
Rating: |  Discuss |   Briefcase | 9,764 reads

Demystifying the use of CASE in an ORDER BY statement

Chuck Hoffman exposes the mysteries of getting CASE statements to work in dynamic ORDER BY statements.  Read more...
By Chuck Hoffman 2015/06/05 (first published: 2012/04/26) | Source: SQLServerCentral.com | Category: case
Rating: |  Discuss |   Briefcase | 24,966 reads

Writing Better T-SQL: Top-Down Design May Not be the Best Choice

One of the best ways in which you can build better applications is by learning to write better T-SQL. Mickey Stuewe begins a new series showing how you might start to think about writing queries.  Read more...
By Mickey Stuewe 2015/06/02 | Source: SQLServerCentral.com | Category: t-sql
Rating: |  Discuss |   Briefcase | 11,236 reads

A Case FOR Cursors...

We've all heard that definitive statement: "Avoid using cursors." But, in my opinion, what really should be conveyed is: "Avoid using row-by-row operations when possible."  Read more...
By Chris Jones 2015/06/01 | Source: SQLServerCentral.com | Category: cursors
Rating: |  Discuss |   Briefcase | 8,999 reads

Using the T-SQL PERCENTILE Analytic Functions in SQL Server 2000, 2005 and 2008

Percentiles give meaning to measurements by telling you the percentage of the population being measured who get higher or lower values. They are now easier to calculate in SQL, and are useful for reporting; but are the new analytic functions faster and more efficient than the older methods? Dwain Camps demonstrates, and investigates their relative performance.   Read more...
By Additional Articles 2015/05/27 | Source: SimpleTalk | Category: percent_rank
Rating: (not yet rated)  Rate this |   Briefcase | 6,617 reads

The Cascading (CROSS) APPLY

An old trick nowadays but one which is still underused here on SSC is the cascading CROSS APPLY – where output from one CROSS APPLY is used as input for another.  Read more...
By Chris Morris 2015/05/25 (first published: 2013/04/16) | Source: SQLServerCentral.com | Category: t-sql
Rating: |  Discuss |   Briefcase | 19,362 reads

T-SQL Programming Part 14 - Using the TOP Clause with UPDATE, INSERT and DELETE Statements

Learn how to use the TOP clause in conjunction with the UPDATE, INSERT and DELETE statements.  Read more...
By Additional Articles 2015/05/14 | Source: Database Journal | Category: t-sql
Rating: (not yet rated)  Rate this |   Briefcase | 10,443 reads

The Case for Scalar-valued, User-defined Functions in T-SQL

Did you know that scalar-valued, user-defined functions can be used in DEFAULT/CHECK CONSTRAINTs and computed columns? Learn about it...  Read more...
By Dwain Camps 2015/05/12 | Source: SQLServerCentral.com | Category: scalar udf
Rating: |  Discuss |   Briefcase | 5,841 reads

Generating A Password in SQL Server with T-SQL from Random Characters

Dallas Snider explains how to use T-SQL to generate a random password that meets an organization's password requirements.  Read more...
By Additional Articles 2015/05/06 | Source: MSSQLTips.com | Category: password
Rating:  Rate this |   Briefcase | 6,967 reads

Time Slots - An Essential Extension to Calendar Tables

After answering many forum entries from developers asking for help with dealing with SQL that involved time intervals and ranges, Dwain dreamed of a generalized tool that sets up time slots of various sorts without the need to experiment; that could do the heavy lifting, so that developers could do aggregations and reports based on time intervals without the hard graft. Here is Dwain's dream made reality.  Read more...
By Additional Articles 2015/05/05 | Source: SimpleTalk | Category: calendar table
Rating:  Rate this |   Briefcase | 6,876 reads

The Elusive Conditional WHERE Clause

What's this, a conditional WHERE clause that doesn't use dynamic SQL?  Read more...
By John Hick 2015/04/17 (first published: 2013/04/18) | Source: SQLServerCentral.com | Category: t-sql
Rating: |  Discuss |   Briefcase | 34,859 reads

Using LAST_VALUE

When I began using LAST_VALUE, the results were not what I expected at all. Read on to learn the secret!  Read more...
By Kathi Kellenberger 2015/04/14 | Source: SQLServerCentral.com | Category: t-sql
Rating: |  Discuss |   Briefcase | 15,693 reads

A Hazard of Using the SQL Update Statement

If you've never encountered this quirk of the SQL UPDATE statement, you should take a look and find a simple way around it.  Read more...
By Dwain Camps 2015/04/06 (first published: 2013/09/09) | Source: SQLServerCentral.com | Category: t-sql
Rating: |  Discuss |   Briefcase | 26,329 reads

Calculating Duration Using DATETIME Start and End Dates (SQL Spackle)

It's an old problem with a solution that's nearly as old. SQL Server MVP Jeff Moden shows us the old trick mixed with a slick trick to format the duration as extended hours, minutes, seconds, and milliseconds.   Read more...
By Jeff Moden 2015/04/03 (first published: 2014/01/16) | Source: SQLServerCentral.com | Category: t-sql
Rating: |  Discuss |   Briefcase | 20,029 reads

Using APPLY to make your queries DRYer

Using the APPLY operator to reduce repetition and make queries DRYer.  Read more...
By Gerald Britton 2015/04/02 | Source: SQLServerCentral.com | Category: queries
Rating: |  Discuss |   Briefcase | 14,534 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 2015/03/27 (first published: 2014/05/08) | Source: SQLServerCentral.com | Category: cumulative
Rating: |  Discuss |   Briefcase | 14,551 reads

Unit Testing with SQL Server

Learn how to begin unit testing with tSQLt and SQL Server.   Read more...
By Alessandro Alpi 2015/03/26 | Source: SQLServerCentral.com | Category: unit testing
Rating: |  Discuss |   Briefcase | 5,996 reads
   Items 1 to 20 of 1189    Older >>