Welcome to EMC Consulting Blogs Sign in | Join | Help

Browse by Tags

All Tags » SQL
Showing page 1 of 6 (57 total posts)
  • 2 + 2 = ?

    As a concise example of the evils of type coercion I came up with the following: INSERT INTO t VALUES ( CAST(2 AS INT), CAST(2 AS INT)); SELECT CASE WHEN x + z = 4 THEN '4' ELSE 'NOT 4' END xPLUSz FROM t; Result: xPLUSz ------ NOT 4 It is left as an exercise for the reader to work out what types x and z ...
    Posted to Data Based (Weblog) by David.Portas on August 26, 2009
  • The Relational Model turns 40

    The Relational Data Model is 40 years old. Edgar Codd first described the idea that databases could be constructed from mathematical relations in an internal IBM Research report in August 1969. The following year his more famous paper on the same topic was published for public consumption. So began a revolution. Data was liberated from its ...
    Posted to Data Based (Weblog) by David.Portas on August 18, 2009
  • DRY SQL

    I recently inherited some SQL that someone else had written and had the job of “tidying it up” before it gets pushed out to production. Here’s a slightly simplified (yes, simplified) version of that SQL: 1: --options 2: select asset_class 3: , case when volume > 0 then 'profit' 4: ...
    Posted to SSIS Junkie (Weblog) by jamie.thomson on July 2, 2009
  • UPDATE FROM the Sybase code museum

    UPDATE FROM is dead … or it should be. Hugo Kornelis has done a good job of explaining why. Apart from a badly thought out and non-portable syntax, UPDATE FROM suffers a notorious bug/feature. I say “notorious” but it’s probably not notorious enough because it is still common to see people get tripped up by it. If I write: UPDATE Alpha SET z ...
    Posted to Data Based (Weblog) by David.Portas on June 24, 2009
  • DB2 9.7 and Database Type Safety

    DB2 has some new features that are aimed at customers who want to transition from Oracle to DB2: http://www-05.ibm.com/ch/events/symposium/pdf/9_M_Obrecht_IBM_Symposium_2009.pdf IBM are emphasising the improved snapshot isolation, PL/SQL support and packages (“modules” in IBM’s terms). One “feature” that caught my eye is support for implicit ...
    Posted to Data Based (Weblog) by David.Portas on June 24, 2009
  • Get on my cloud...

    I have been dipping my toes into the cloud and found some pretty exciting stuff from Amazon. Simple DB is Amazon's web service database and it is now in unlimited beta which means that anyone can sign up and start using the service free (some restrictions), just signup here. There are loads of technical resources and also a pretty complete FAQ ...
    Posted to John Brookmyre's Blog (Weblog) by john.brookmyre on December 9, 2008
  • An Epitaph for a Stored Procedure (no, not really)

    Simon Evans some time ago questioned if given the parametric nature of queries generated by ORMs, stored procedures still have a place in developers toolbox? At the end of the day why bother if ORMs seem these days seem to do everything for free? It looks to me that statement that ''stored procedures are dead'' (although Simon has never said that) ...
    Posted to Memoirs of a Plumber (Weblog) by marcin.kaluza on November 10, 2008
  • Getting rid of Getdate()...

    Ok I admit - I use it. Pretty much everyone I know uses it and yet I feel dirty when I do.  Why? Well it's not portable SQL and most certainly not ANSI standard.  I need to get the datetime I hear you say.  How do I do this without getdate()?  There is a perfectly good substitute in the form of CURRENT_TIMESTAMP that is ...
  • Using a Bitmask - a practical example

    A colleague of mine asked for a simple example to get him up and running with the basics of bitmasking.  Since I had gone to the effort to create the example I thought I might as well blog it :o). This example uses the logical AND operator &. First of all you need to define your table.. create table BitmaskDemo (ID int Primary ...
  • T-SQL IDENTITY : Fun and Games with DBCC CHECKIDENT

      This issue caught me out today whilst putting together some build scripts for reference data. So I thought I’d share it. USE [tempdb] GO CREATE TABLE [dbo].[Table_1](       [Col1] [int] IDENTITY(1,1) NOT NULL,       [Col2] [char](1) NOT NULL ) ON [PRIMARY] GO delete from ...
1 2 3 4 5 Next > ... Last »
Powered by Community Server (Personal Edition), by Telligent Systems