in

SQL Server Community Blogs

Voices of the SQL Server Community
All Tags » t-sql (RSS)

Browse by Tags

  • 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 03-11-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 01-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 01-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 01-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 01-08-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 01-04-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 12-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 12-14-2009
  • Removing unwanted characters - Part 2

    In my previous post about Removing unwanted characters , I posted a method that used a function Here is another method that uses Dynamic SQL declare @data table ( data varchar ( 100 )) -- table that has source data insert @data select 'tes^@&t %stri)-n!g' data union all select '))aaer...
    Posted to Madhivanan (Weblog) by Madhivanan on 12-02-2009
  • DATA ACCESS setting on local server

    When you look at the sys.servers catalog view, you will see list of linked servers defined on the server plus one additional row for the server itself. You can distinguish the local server from linked servers by column server_id, which in case of local server has value of 0. select server_id , name ...
    Posted to Piotr Rodak (Weblog) by Piotr Rodak on 11-22-2009
Page 1 of 9 (81 items) 1 2 3 4 5 Next > ... Last ยป
Powered by Community Server (Commercial Edition), by Telligent Systems