Forum Replies Created

Viewing 15 posts - 3,481 through 3,495 (of 4,085 total)

  • RE: concate date and time field

    Cadavre (11/17/2011)


    PRINT '========== Alternative=========='

    SELECT @Holder = randomDate + randomTime

    FROM #testEnvironment

    PRINT '========== Alternative 2=========='

    SELECT @Holder = DATEADD(SECOND, DATEDIFF(SECOND, 0, randomTime), randomDate)

    FROM #testEnvironment

    PRINT '========== Alternative 3=========='

    SELECT @Holder = DATEADD(d, DATEDIFF(d, randomTime, randomDate),...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Pivot table query - making it dynamic

    You're probably better off leaving the pivot to your reporting software. You don't provide enough details to say for sure.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: concate date and time field

    It has been repeatedly shown that manipulating dates by converting back and forth between character data performs very poorly versus using the datetime functions. The following code will always...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Query xml column

    The .value() function requires a singleton, and you may not have specified the singleton correctly.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: How to disable output of crusors

    ahmed_b72 (11/16/2011)


    Is there a way to avoid displaying every row returned from the cursor?

    The best way is to avoid using a cursor in the first place. They perform horribly...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Cursor Variable in EXEC Statement

    CELKO (11/16/2011)


    SQL is declarative, so we do this stuff in the DDL, not in fake mag tapes. The number of suffixes is constant and short, so put it in a...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Query xml column

    You're most of the way there. This should give you what you want. The vast majority of the time, you'll probably want to use relative paths for everything...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Concatenate All Duplicate Values

    Your data doesn't have enough information to fully specify the order, so the order is not completely guaranteed. For example 17 could easily render as "Riding on big horses...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Cursor Variable in EXEC Statement

    MattieNH (11/16/2011)


    I have a table of valid suffixes that I want to loop through (yes, a cursor).

    You really don't. There is nothing in your query that indicates that a...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Can't figure out why the following T-SQL script doesn't work...

    John Mitchell-245523 (11/16/2011)


    That UPDATE statement won't loop through the rows in @Dept - it will use the first row in @Depts that it finds and then stop.

    Actually, as Jeff Moden...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: calculating a median for groups

    A good rule of thumb to use is that you should not use code that you find on the Internet unless you understand what it is doing. If a...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: IF versus CASE statements

    Lowell (11/15/2011)


    your example is bending an IF into a situation similar to a CASE, but an IF statement can do much more than that.

    I would argue that he's doing the...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: add bold in for xml type

    It's because your '<B>' is text, not xml. The easiest way is to use the following:

    select

    = convert(varchar(3), t.num),'',

    ...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Help with MERGE Statement

    It looks like you're trying to run this on a SQL 2005 server. MERGE was introduced in SQL 2008, so it will produce those exact errors when run on...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: How to check only the numeric values at the same time ignoring the symbols or characters using SQL queries

    Even so, the performance may still be better using the string splitter than without. The only way to now for sure is thorough testing, which is why I initially...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 3,481 through 3,495 (of 4,085 total)