THE SQL Server Blog Spot on the Web

Welcome to SQLblog.com - The SQL Server blog spot on the web Sign in | |
in Search

Browse by Tags

All Tags » TSQL   (RSS)
Showing page 1 of 2 (15 total posts)
  • Updated File & Wait Statistics Procedures

              For many years I have been using a set of stored procedures to capture and report on both the file and wait statistics inside of SQL Server and I just recently did some minor modifications that I want others to be aware of. Since many of you have received copies of the past revisions ...
    Posted to Andrew Kelly (Weblog) by Andrew Kelly on February 13, 2014
  • sp_spaceused Alternative

            I don’t know why but for some reason I have never liked using sp_spaceused. It probably started a long time ago when the results were often inaccurate due to the meta data being out of date. I am pretty sure that was fixed somewhere along the line but the system stored procedure had some other limitations ...
    Posted to Andrew Kelly (Weblog) by Andrew Kelly on May 17, 2013
  • Fun with Aggregates

    There are interesting things to be learned from even the simplest queries.  For example, imagine you are given the task of writing a query to list AdventureWorks product names where the product has at least one entry in the transaction history table, but fewer than ten. One possible query to meet that specification is: SELECT ...
    Posted to Paul White: Page Free Space (Weblog) by Paul White on March 11, 2012
  • Is Distinct Aggregation Still Considered Harmful?

    Back in 2008, Marc Friedman of the SQL Server Query Processor Team wrote a blog entry entitled “Distinct Aggregation Considered Harmful”, in which he shows a way to work around the poor performance that often results simply from adding the keyword DISTINCT to an otherwise perfectly reasonable aggregate function in a query.  This post is an ...
    Posted to Paul White: Page Free Space (Weblog) by Paul White on December 3, 2011
  • How Parallelism Works in SQL Server

    You might have noticed that January was a quiet blogging month for me.  Part of the reason was that I was working on a series of articles for Simple Talk, examining how parallel query execution really works.  The first part is published today ...
    Posted to Paul White: Page Free Space (Weblog) by Paul White on March 5, 2011
  • Why can't we have column alias in ORDER BY?

    You probably think something like ''What! Of course we can!''. And so did I when I read the title for a post about this in a forum. Let us first establish that you can have a column alias in ORDER BY:SELECT p.ProductID AS pid,p.ListPrice AS prFROM Production.Product AS pORDER BY pr The problem was that a table name was also in the ORDER BY ...
    Posted to Tibor Karaszi (Weblog) by TiborKaraszi on October 3, 2010
  • Sorting, Row Goals, and the TOP 100 Problem

    When you write a query to return the first few rows from a potential result set, you’ll often use the TOP clause.  To give a precise meaning to the TOP operation, it will normally be accompanied by an ORDER BY clause.  Together, the TOP…ORDER BY construction can be used to precisely identify which top ‘n’ rows should be returned. The ...
    Posted to Paul White: Page Free Space (Weblog) by Paul White on August 26, 2010
  • Be careful with constraints calling UDFs

    You might just not get what you think. I would be surprised if this hasn't been blogged already, but if so, it would be worth repeating. Here's the deal (example from a forum,, slightly re-worked): I want the values in one column to be unique, assuming the value in another column is 1. Can I use an UDF for that? On the surface, yes. You can ...
    Posted to Tibor Karaszi (Weblog) by TiborKaraszi on December 17, 2009
  • Cleaning up Un-Named Defaults

    I just had a situation in which we are automating the comparing of databases and I came across a bunch of Defaults that were never explicitly named. This causes them to get a new name each time you create them and makes it much more difficult to write future update scripts when you don’t know the actual name it will be. In any case I decided to ...
    Posted to Andrew Kelly (Weblog) by Andrew Kelly on June 26, 2009
  • My datetime article updated for 2008

    Actually, the article has been out for about a month now, but I first solicited feedback on errors and typo's and then I forgot to mention the update here... Anyhow, the article now also covers 2008 and the new date, time, datetime2 and datetimeoffset types. There are some interesting aspects of the new types which sets them apart from the old ...
    Posted to Tibor Karaszi (Weblog) by TiborKaraszi on September 23, 2008
1 2 Next >
Powered by Community Server (Commercial Edition), by Telligent Systems
  Privacy Statement