SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Articles with tag T-SQL Rss

Search for any content tagged t-sql

   Items 1 to 20 of 1295    Older >>
 

Holidays and Calendar Generation

Create the definition of your holidays and have them available for any year. Create a Calendar including holidays and business/work dates.  Read more...
By Paul Hunter 2017/12/15 (first published: 2016/02/16) | Source: SQLServerCentral.com | Category: t-sql
Rating: |  Discuss |   Briefcase | 4,344 reads

Bones of SQL – Grouping By User-Defined Calendar Periods

Although it is common to group by periods such as Week, Month, or Quarter, sometimes alternative periods are needed. This simple technique lets you split a year into periods with any number of days.  Read more...
By Bob Hovious 2017/12/08 (first published: 2016/09/26) | Source: SQLServerCentral.com | Category: date manipulation
Rating: |  Discuss |   Briefcase | 2,317 reads

Bones of SQL - Practical Calendar Queries

After the first article created a Calendar table, learn how to use this in a practical sense with some common queries.  Read more...
By Bob Hovious 2017/12/01 (first published: 2016/10/13) | Source: SQLServerCentral.com | Category: t-sql
Rating: |  Discuss |   Briefcase | 3,191 reads

The Difference Between Rollup and Cube

Learn about the fundamental differences between the ROLLUP and CUBE operators.  Read more...
By Ben Richardson 2017/11/30 | Source: SQLServerCentral.com | Category: t-sql
Rating: |  Discuss |   Briefcase | 1,316 reads

Name Value Pairs Table Handling

While Name Value Pairs Tables are anathema to Relational Database professionals, it is sometimes useful to consider such a structure in a production application. This article illustrates the use of User-defined Table Type to improve such handling.  Read more...
By Jerome Boyer 2017/11/06 | Source: SQLServerCentral.com | Category: user-defined table type
Rating: |  Discuss |   Briefcase | 1,281 reads

Core T-SQL

Steve Jones thinks there is a list of core skills that any database developer or DBA needs. This week he asks you for a list of those things you think should be included.  Read more...
By Steve Jones 2017/11/03 | Source: SQLServerCentral.com | Category: editorial
Rating: |  Discuss |   Briefcase | 729 reads

Parse Data from a Field Containing Multiple Values using CROSS APPLY

It is possible for a field in a character-delimited text file to contain a list of further-delimited values instead of the customary single value. This article demonstrates how to load such a file into a staging table, then use a CROSS APPLY query to parse the list of values into a related table.  Read more...
By Stan Kulp 2017/10/30 | Source: SQLServerCentral.com | Category: integration services (ssis)
Rating: |  Discuss |   Briefcase | 1,597 reads

Simple SQL: Random Thoughts

How does one get a truly random sample of data of a certain size from a SQL Server database table. Well, there are simple non-portable tricks one can use, such as the NewID() function, but then refining those can be tricky. Take the Rand() function for a start. Can it really provide you with a truly random number? Why doesn't the TABLESAMPLE clause give you a set number of rows? Joe Celko scratches his head a bit, explains some of the issues and invites some suggestions and tricks from readers.  Read more...
By Additional Articles 2017/10/19 | Source: SimpleTalk | Category: t-sql
Rating: (not yet rated)  Rate this |   Briefcase | 3,384 reads

The Basics of Good T-SQL Coding Style – Part 4: Performance

There are several obvious problems with poor SQL Coding habits. It can make code difficult to maintain, or can confuse your team colleagues. It can make refactoring a chore or make testing difficult. The most serious problem is poor performance. You can write SQL that looks beautiful but performs sluggishly, or interferes with other threads. A busy database developer adopts good habits so as to avoid staring at execution plans. Rob Sheldon gives some examples.  Read more...
By Additional Articles 2017/10/05 | Source: SimpleTalk | Category: t-sql
Rating: (not yet rated)  Rate this |   Briefcase | 5,733 reads

When sp_HelpText is not so helpful!

A note of caution on the use of sp_helptext to script out objects.  Read more...
By Andy Robertson 2017/09/25 | Source: SQLServerCentral.com | Category: t-sql
Rating: |  Discuss |   Briefcase | 1,147 reads

Insert Stored Procedure Results Into New Table Without Using OPENQUERY

OPENQUERY arrives with a lot of baggage. Try this alternative technique to inserting stored procedure results into a new table.  Read more...
By Orlando Colamatteo 2017/09/22 (first published: 2016/03/22) | Source: SQLServerCentral.com | Category: t-sql
Rating: |  Discuss |   Briefcase | 8,036 reads

SQL Data Aggregation Aggravation

When we have to deal with and store a lot of data, it makes sense to aggregate it so that we store only the information we actually need. If we get this right, this works well, but the design of the system takes care and thought because the problems can be subtle and various. Joe Celko describes some of the ways that things can go wrong and end up providing incorrect, inaccurate or misleading results.  Read more...
By Additional Articles 2017/09/12 | Source: SimpleTalk | Category: t-sql
Rating: (not yet rated)  Rate this |   Briefcase | 3,651 reads

Challenge Your Code Design

How to structure your T-SQL objects and incorporate design principles.  Read more...
By Gary Strange 2017/09/11 | Source: SQLServerCentral.com | Category: query tuning
Rating: |  Discuss |   Briefcase | 1,305 reads

Statistics in SQL: The Mann–Whitney U test

Phil Factor shows how to use the Mann-Whitney U test in SQL to to find out whether two samples come from the same distribution.  Read more...
By Additional Articles 2017/09/04 | Source: SimpleTalk | Category: t-sql
Rating:  Rate this |   Briefcase | 3,918 reads

Curious Case of SUM Function

How a simple SUM statement could change an output.  Read more...
By Utsav Verma 2017/08/24 | Source: SQLServerCentral.com | Category: sum()
Rating: |  Discuss |   Briefcase | 1,858 reads

Is It Time To Stop Using IsNumeric()?

The old system function IsNumeric() often causes exasperation to a developer who is unfamiliar with the quirks of Transact SQL. It seems to think a comma or a number with a 'D' in the midde of it is a number. Phil Factor explains that though IsNumeric has its bugs, it real vice is that it doesn't tell you which of the numeric datatypes the string parameter can be coerced into, and because it doesn't check for overflow. Phil comes to the rescue with a couple of useful alternatives, one of which works whatever version of SQL Server you have, and which tell you what datatype the string can be converted to.  Read more...
By Additional Articles 2017/08/21 | Source: SimpleTalk | Category: isnumeric()
Rating: (not yet rated)  Rate this |   Briefcase | 4,249 reads

Using multiple custom SQL formatting styles in SQL Prompt

Usually, when coding SQL, you will want to go along with the coding style of the team you are working with. This article shows how to use SQL Prompt formatting styles to create and maintain multiple code styles, each for a dedicated purpose, and to switch between them and apply a new style to existing code, with ease.  Read more...
By 2017/08/14 | Source: Redgate | Category: t-sql
Rating: (not yet rated)  Rate this |   Briefcase | 3,923 reads

Statistics in SQL: The Kruskal–Wallis Test

Before you report your conclusions about your data, have you checked whether your 'actionable' figures occurred by chance? The Kruskal-Wallis test is a safe way of determining whether samples come from the same population, because it is simple and doesn't rely on a normal distribution in the population. This allows you a measure of confidence that your results are 'significant'. Phil Factor explains how to do it.  Read more...
By Additional Articles 2017/07/27 | Source: SimpleTalk | Category: t-sql
Rating:  Rate this |   Briefcase | 5,497 reads

The Basics of Good T-SQL Coding Style – Part 2: Defining Database Objects

Technical debt is a real problem in database development, where corners have been cut in the rush to keep to dates. The result may work but the problems are in the details: such things as inconsistent naming of objects, or of defining columns; sloppy use of data types, archaic syntax or obsolete system functions. With databases, technical debt is even harder to pay back. Robert Sheldon explains how and why you can get it right first time instead.  Read more...
By Additional Articles 2017/07/25 | Source: SimpleTalk | Category: t-sql
Rating: (not yet rated)  Rate this |   Briefcase | 5,655 reads

SQL Server User-Defined Functions

User-Defined Functions (UDFs) are an essential part of the database developers' armoury. They are extraordinarily versatile, but just because you can even use scalar UDFs in WHERE clauses, computed columns and check constraints doesn't mean that you should. Multi-statement UDFs come at a cost and it is good to understand all the restrictions and potential drawbacks. Phil Factor gives an overview of User-defined functions: their virtues, vices and their syntax.  Read more...
By Additional Articles 2017/07/21 | Source: SimpleTalk | Category: t-sql
Rating: (not yet rated)  Rate this |   Briefcase | 5,410 reads
   Items 1 to 20 of 1295    Older >>