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 » SQL Server » T-SQL   (RSS)
Showing page 2 of 6 (56 total posts)
  • Use VALUES clause to get the maximum value from some columns [SQL Server, T-SQL]

    My ex-colleague Paul Mcmillan pointed me at a thread on Stack Overflow that demonstrated a neat T-SQL trick to get the maximum value from a collection of columns in a row. Paul had never seen it before and neither had I so I figure one or two of you out there might learn something from it too. In short you can use the VALUES clause to effectively ...
    Posted to Jamie Thomson (Weblog) by jamiet on January 20, 2012
  • Delete all data from a database

    Sometimes I use this blog to share scripts that I know I'm going to need at some point in the future, this is one of those times. The script below will remove all data from a database while respecting/preserving all foreign key constraints - very useful in a development or test environment if you want to get back to a ''vanilla'' snapshot of your ...
    Posted to Jamie Thomson (Weblog) by jamiet on September 19, 2011
  • [T-SQL Tuesday] Some code is born crap, some code achieves crapness and some code has crapness thrust upon it!

    I recently returned to a client at which I last worked back in 2006 and, as you might imagine, that gives me ample material for a blog post dedicated to Crap Code; conveniently the subject of the latest T-SQL Tuesday. I first worked for this client back in 2004 and that is significant because back then we were writing code on SQL Server 2000. Ah, ...
    Posted to Jamie Thomson (Weblog) by jamiet on August 10, 2011
  • On the typeof() campaign trail

    Given a table: CREATE TABLE [person] (  [id] INT IDENTITY(1,1) ,  [name] VARCHAR(100) ,  [age] INT); How nice would it be to be able to do something like this inside your stored procedures?: DECLARE @person TABLE (  [name] typeof([person].[name]) ,  [age] typeof([person].[age])); Or, perhaps, ...
    Posted to Jamie Thomson (Weblog) by jamiet on August 10, 2011
  • SQL_VARIANT_PROPERTY function

    I learnt something about T-SQL today that I never knew and I figure I’m not the only one so it might be worth sharing what I learnt; namely, I discovered the SQL_VARIANT_PROPERTY function. It all started when going over a piece of code that I recently inherited, here is an abbreviated version of that code in order to demonstrate the ...
    Posted to Jamie Thomson (Weblog) by jamiet on August 3, 2011
  • Debunking Kimball Effective Dates part 2 – Windowing Functions

    Reigniting the [SCDEndDate] debate In November 2009 I wrote a blog post entitled Debunking Kimball Effective Dates where I stated that I was against the Kimball-recommended practice of maintaining a StartDate & EndDate value for every record in a type 2 slowly changing dimension (SCD) table (i.e. the values highlighted in blue in the ...
    Posted to Jamie Thomson (Weblog) by jamiet on July 13, 2011
  • Maintaining version history in your database using Visual Studio 2010

    I have written a few blogs lately explaining how my current project is employing the use of datadude (aka the database development tools in Visual Studio 2010) in order to manage our database code, deployment of that code and also testing of it. In this blog post I’m going to share a little technique that we use in order to store a version history ...
    Posted to Jamie Thomson (Weblog) by jamiet on October 19, 2010
  • bug with sp_rename + sp_refreshview

    Today I’ve found with my Italian collegues a “nice” bug that made us and the customer mad for several hours. The problem is related to sp_rename usage and sp_refreshview. If you have a view like this one create view dbo.a as select c = 1 go and for any reason someone renames it (for example because he wants to change the view but don’t ...
    Posted to Davide Mauri (Weblog) by manowar on October 12, 2010
  • Changing the security context with Dynamic SQL [T-SQL]

    I’ve always found that understanding the SQL security model can be a finicky affair; that’s no criticism, its more to do with my reluctance to actually spend time immersing myself in it – I generally know what I need to know and that’s all. I remember back when I was first learning T-SQL I found the whole area of security around dynamic SQL ...
    Posted to Jamie Thomson (Weblog) by jamiet on October 4, 2010
  • Take your script library with you [T-SQL]

    As SQL professionals I’m sure many of you build up a library of SQL scripts that you take from project to project, right? Here’s a tip for those of you that have such a collection and want to make sure that you always have ready access to it. I’m a big fan of all things sync-related and there are many tools on the market now that will sync the ...
    Posted to Jamie Thomson (Weblog) by jamiet on October 3, 2010
< Previous 1 2 3 4 5 Next > ... Last »
Powered by Community Server (Commercial Edition), by Telligent Systems
  Privacy Statement