Justin Cooney

Web Development Tips and Examples

  • MS SQL Server
    MS SQL Server

    In this article I will review three easy methods that can be used to replace extra spaces between words in a string. Note that if you want to remove extra spaces from the start and end of your string you will still need to encapsulate the output of the routines within the standard LTrim / RTrim functions.

    Each of these methods works quite nicely and can either be written directly into your code, or can be added as a user-defined function. I have tested these functions in SQL Server 2000 and SQL Server 2008 and they work very well in either of these versions of SQL Server.

    Please have a look at some of the other aricles I have written covering SQL Server.

    (more…)
  • SQL Server
    SQL Server

    The OUTPUT clause is a useful part of your T-SQL arsenal that has been added as of SQL Server 2005. You can use the OUTPUT clause in the same vein as @@IDENTITY, IDENT_CURRENT, or SCOPE_IDENTITY(), or even extend it to be a historical logging mechanism.

    Unlike @@IDENTITY, or SCOPE_IDENTITY(), you need to populate a table rather than a variable when using the OUTPUT clause. This of course has its advantages as well in that you are able to log batch operations and easily store before/after historical information.

    Further, Microsoft itself recommends using the OUTPUT clause rather than the @@IDENTITY or SCOPE_IDENTITY() since the latter two can cause problems if your queries use parallel execution plans. Have a look at the Microsoft Knowledgebase Article on the topic: http://support.microsoft.com/kb/2019779 (more…)

  • Programming Server Side
    Programming Languages Review

    I’ve always been curious about the popularity of the most commonly used programming languages, but haven’t been able to find a reliable (non-biased) source.

    I decided to take matters into my own hands and use the Google trends tool to see the frequency with which five of the most commonly used server-side programming languages have been referenced worldwide in the past twelve months (ranging from April 25 2012 to April 25 2013.) (more…)