Forum Replies Created

Viewing 15 posts - 31 through 45 (of 1,155 total)

  • RE: Add dash to data

    I agree with Joe that this should be done in the presentation/application layer. I understand that sometimes this is beyond your control. If you absolutely must accomplish this...

  • RE: Query using right function in where clause is failing

    No need for a computer column here. You should use the like operator.

    DECLARE @t TABLE(

    col VARCHAR(10)

    );

    INSERT INTO @t VALUES ('13abc');

    INSERT INTO @t VALUES ('1abcde');

    SELECT *

    FROM @t

    where col NOT LIKE...

  • RE: Calculate total hours

    Something like this should work.

    DECLARE @T TABLE (ModifiedDate DATETIME, Ignition BIT)

    INSERT INTO @t (modifieddate,Ignition)

    SELECT '2010-07-05 13:36:24.470', 0

    UNION ALL

    SELECT '2010-07-05 13:37:28.513', 0

    UNION ALL

    SELECT '2010-07-05 13:38:33.560' ,1

    UNION ALL

    SELECT '2010-07-05...

  • RE: SQL JOINS BETTER WAY

    There should be no difference in performance because the plans should be the same. The plans should be the same because the optimizer is smart enough to only output...

  • RE: Concatenating Text to Numeric Data

    This is a pretty straight forward request. You only need to use the right function to pad the string.

    DECLARE @t TABLE(Id INT);

    INSERT INTO @t VALUES(1);

    INSERT INTO @t VALUES(10);

    INSERT INTO...

  • RE: REPLACE() and NULL

    Correct, so my assumption is the code has some control flow logic checks that make the loop exit early if NULL values are detected, but it doesnt make sense to...

  • RE: REPLACE() and NULL

    I personally think the reason the function returns null is because of NULL concatenation math. I think the underlying code uses loops and concatentates the string piece by piece...

  • RE: LIKE

    Richard Tatterton (6/24/2010)


    This is what I absolutely hate about SQL Server. A string is a f**king string, no matter whether it's got spaces on it at the end.

    Jeez.

    While this is...

  • RE: Cursors Be Gone!

    GabyYYZ (12/24/2008)


    Sigh...

    The while loop I used was only a proof of concept, and was designed to show people the mechanics of breaking out of a cursor mindset. They are...

  • RE: Intersect, Except, Union, All and Any

    noeld (5/24/2010)


    johan.lindell (5/24/2010)


    Good comparison, David, thanks.

    From a performance perspective, using NOT IN is "always" slower than using EXISTS. If you try running the below queries

    -- INTERSECT

    SELECT CustomerID

    FROM Sales.Customer

    WHERE TerritoryID=10

    AND NOT...

  • RE: Play with NULLIF

    I think it is also important to understand what is going on underneath the hood, when NULLIF is used. Unbeknownst to some, NULLIF is actually a case expression under the...

  • RE: Finding the Correct Weekday Regardless of DateFirst

    Another solution is to use date math.

    DECLARE @dt DATETIME,

    @Day_Start SMALLINT

    SET @Day_Start = 0--0=Sun,1=Mon,2=Tue,3=Wed,4=Thu,5=Fri,6=Sat

    SET @dt = '20091219'

    SELECT

    --Day Of Week formula:

    --datediff of @Day_Start (this...

  • RE: Getting Started with SQL Server Event Notifications

    Great Job Jonathan! I look forward to part 2.

  • RE: Convert String to a Table using CTE

    Jeff Moden (12/14/2009)


    Aaron Gonzalez-394690 (12/14/2009)


    I second Roland's comment.

    I was involved in a similar situation before and since we were working with sql server 2005 I had the developer pass a...

  • RE: Indexed View

    You have to add the noexpand hint to the query to use the view's index. The noexpand hint forces the optimizer to use the views data instead of the...

Viewing 15 posts - 31 through 45 (of 1,155 total)