THE SQL Server Blog Spot on the Web

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

Browse by Tags

All Tags » T-SQL » SQL Server   (RSS)
Showing page 2 of 6 (55 total posts)
  • 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

    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
  • Query for index column information

    On nearly every project I ever work on I end up crafting a query that tells me all the information about the indexes in a database. I do of course keep a collection of useful scripts hanging around though when I’m on client site its not always accessible and given how often I end up writing this damn thing I figured I’d just make it easy on myself ...
    Posted to Jamie Thomson (Weblog) by jamiet on September 16, 2010
< Previous 1 2 3 4 5 Next > ... Last »
Powered by Community Server (Commercial Edition), by Telligent Systems
  Privacy Statement