SQL Server Blogs

Voices from the UK SQL Server Community
All Tags » T-SQL (RSS)

Browse by Tags

  • COLUMNS_UPDATED() for audit triggers

    In SQL Server 2005, triggers are pretty much the only option if you want to audit changes to a table. There are many ways you can decide to store the change information. You may decide to store every changed row as a whole, either in a history table or as xml in audit table. The former case requires...
    Posted to Piotr Rodak (Weblog) by Piotr Rodak on Wed, Apr 28 2010
  • Coding standards

    This post will be about coding standards. There are countless articles and blog posts related to this topic, so I know this post will not be too revealing. Yet I would like to mention a few things I came across during my work with the T-SQL code. Naming convention - there are many of them obviously....
    Posted to Piotr Rodak (Weblog) by Piotr Rodak on Thu, Mar 11 2010
  • Moved my blog

    For all those reading my blog, for your information, I have moved my blog to Thanks to Simon for his support at
    Posted to Madhivanan (Weblog) by Madhivanan on Tue, Feb 2 2010
  • relative query cost not accurate when using set rowcount

    When tuning performance of a query, it is quite common to compare different variants of the query in the same batch and compare the execution plans to see if changes that you made actually work for better or not. Often you would compare just relative cost of execution plan of a query within the batch...
    Posted to Piotr Rodak (Weblog) by Piotr Rodak on Wed, Jan 27 2010
  • updating column with a random value

    I have been working recently on load testing of our ETL. One of the factors that determines amount of transfered data is a lookup table that is joined to the source. I populated this table with aproppriate values, and then realized that I also need some values in second column, and they were null. Let's...
    Posted to Piotr Rodak (Weblog) by Piotr Rodak on Wed, Jan 13 2010
  • Find alternate week day

    My co-worker had a task of finding minimum alternate week day as of today for a given date and day Consider these data Date : 2009-12-22 day : 5 (it denotes Thursday) It means the event was scheduled on 2009-12-22 which should run on every alternate Thursday starting from 2009-12-24 (The first Thursday...
    Posted to Madhivanan (Weblog) by Madhivanan on Tue, Jan 12 2010
  • Replace data of one table with data of other table

    One of the questions asked in a forum was about replacing data of one table by the data of another table The solution that the questioner used was having cursor by looping through the source table and replace particular words by other words from another table by matching the words Here is my alternate...
    Posted to Madhivanan (Weblog) by Madhivanan on Fri, Jan 8 2010
  • updlock, holdlock and deadlocks

    We have a process that manages sliding window over a number of tables in our reporting database. This process is triggered by first call to our reporting ETL. There is table that contains two dates that are important for the partitioning and business requirements. The table is build as the following...
    Posted to Piotr Rodak (Weblog) by Piotr Rodak on Mon, Jan 4 2010
  • Happy Holidays

    In the Query Analyser, set the Result mode to Text (Press CTRL+T) and run the following code set nocount on select space ( 17 - len ( replicate ( char ( 94 ), no )))+ replicate ( char ( 94 ), no * 2 - 1 ) from ( select top 10 row_number () over ( order by name ) as no from sysobjects ) as t union all...
    Posted to Madhivanan (Weblog) by Madhivanan on Thu, Dec 31 2009
  • Search a value in character column of all tables

    Sometimes, you may need to find a value in the characters columns (char, varchar, etc) in all the tables This is one of the methods to do it declare @sql varchar ( max ), @search varchar ( 100 ) set @sql = '' set @search = 'your search string' select @sql = @sql + 'select '''...
    Posted to Madhivanan (Weblog) by Madhivanan on Mon, Dec 14 2009
Page 2 of 10 (93 items) < Previous 1 2 3 4 5 Next > ... Last ยป
Powered by Community Server (Commercial Edition), by Telligent Systems