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 1287    Older >>
 

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,323 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,126 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 | 7,821 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,580 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,279 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,498 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,829 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,195 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,865 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,004 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,587 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,352 reads

Stairway to Advanced T-SQL Level 8: Functions to Generate Date and Time values

When you build applications that store records in SQL Server you will most likely have to store date and time values as part of the data. To manage all the different date related tasks you might need to perform Microsoft has introduced a number of date functions. In this stairway I will be exploring those date and time functions.  Read more...
By Gregory Larsen 2017/07/19 (first published: 2015/10/21) | Category: stairway series
Rating: |  Discuss |   Briefcase | 7,480 reads

Simple SQL: Attribute Splitting

If the design of a relational database is wrong, no amount of clever DML SQL will make it work well. Dr. Codd’s Information Principle is that you have, inside the entity tables, the columns that model the attributes of that entity. The columns contain scalar values. Tables that model relationships can have attributes, but they must have references to entities in the schema. You split those attributes at your peril. Joe Celko explains the basics.  Read more...
By Additional Articles 2017/07/18 | Source: SimpleTalk | Category: t-sql
Rating:  Rate this |   Briefcase | 3,640 reads

The Panjandrum Conundrum

With progress thwarted by a committee of panjandrums, will T-SQL forever remain in the doldrums? So wonders Phil Factor.  Read more...
By Phil Factor 2017/07/10 | Source: SQLServerCentral.com | Category: editorial
Rating: |  Discuss |   Briefcase | 70 reads

The Basics of Good T-SQL Coding Style

TSQL Code must work properly and efficiently. That's not enough though. Unless you are working alone, have perfect memory and plan to never change job, then you need to comment and document your code, it must be inherently readable, well laid out, use informative and obvious names, and it must be robust and resilient; written defensively. It must not rely on deprecated features of SQL Server, or assume particular database settings. Robert Sheldon starts a series of articles that explains the basics.  Read more...
By Additional Articles 2017/07/05 | Source: SimpleTalk | Category: t-sql
Rating:  Rate this |   Briefcase | 5,934 reads

SQL Server Row Count for all Tables in a Database

Dattatrey Sindol explains the different ways in which you can get the row counts from all the tables in a SQL Server database.  Read more...
By Additional Articles 2017/06/22 | Source: MSSQLTips.com | Category: row count
Rating: (not yet rated)  Rate this |   Briefcase | 5,284 reads

Use T-SQL to Find Folders Using the Most Disk Space

Your SQL Server drives are running out of disk space and you want a way to quickly tell which sub-directories are taking the most space - here's how to do it with T-SQL.  Read more...
By Additional Articles 2017/06/16 | Source: MSSQLTips.com | Category: t-sql
Rating: (not yet rated)  Rate this |   Briefcase | 4,739 reads

Setting Variables in Calling T-SQL Code While Using sp_executesql

In this tip, Greg Larsen shows you how to set variables in your calling T-SQL code when using sp_execute sql.  Read more...
By Additional Articles 2017/06/14 | Source: Database Journal | Category: variables
Rating: (not yet rated)  Rate this |   Briefcase | 3,634 reads

The OUTPUT Clause for the MERGE Statements

In this article, I will provide a set of examples to showcase the use of OUTPUT clause within the MERGE statement and how to capture the OUTPUT clause results into an archive table.  Read more...
By Amarendra Reddy Thummeti 2017/06/08 | Source: SQLServerCentral.com | Category: t-sql
Rating: |  Discuss |   Briefcase | 6,842 reads
   Items 1 to 20 of 1287    Older >>