Forum Replies Created

Viewing 15 posts - 3,286 through 3,300 (of 3,957 total)

  • RE: Time difference bewteen two different data rows

    Perhaps something like this?

    SELECT ID, UName, alert_datetime

    ,Diff=CONVERT(VARCHAR(15), CAST(DATEADD(millisecond, (

    SELECT DATEDIFF(millisecond, t2.alert_datetime, t1.alert_datetime)

    ...

  • RE: Are the posted questions getting worse?

    EL Jerry (6/26/2012)

    The BOOLEAN data type would only have two values: TRUE or FALSE. Not 0, 1 or NULL, just TRUE or FALSE. This is why it would...

  • RE: What would be the best way to get the date from the following strings?

    If you want Availability to end up as a DATE datatype, the trouble is obviously with the date that is missing the day. You can handle that like this...

  • RE: select statement and output parameter

    anush_tar (6/26/2012)


    Sorry I had to say working only on SQL Server 2005:-D I want something like it to work on sql server 2008 R2.

    This is a part of SP, I...

  • RE: Sum DISTINCT fields only

    Les Cardwell (6/26/2012)


    DROP TABLE #T;

    CREATE TABLE #T(Col1 INT)

    INSERT INTO #T

    SELECT 1 UNION ALL

    SELECT 1 UNION ALL

    SELECT 2 UNION ALL

    SELECT 3 UNION ALL

    SELECT 4 UNION ALL

    SELECT 1

    --SELECT SUM(DISTINCT(Col1)) AS 'Sum of...

  • RE: UNPIVOT with where clause

    Tom Bakerman (6/26/2012)


    dwain.c (6/25/2012)


    You can also do it like this:

    SELECT x.MyId, MIN(MinAmt)

    FROM #test

    CROSS APPLY (

    VALUES (MyID, MV1), (MyID, MV2), (MyID, MV3), (MyID, MV4)) x(MyID, MinAmt)

    WHERE MinAmt >= 150

    GROUP BY x.MyID

    I've...

  • RE: Compare the text in a string (Re-post)

    dwain.c (6/24/2012)


    This is not guaranteed to work in all cases (e.g., where @ may appear outside of an email string) but using Jeff Moden's DelimitedSplit8K string splitter, you can try...

  • RE: UNPIVOT with where clause

    You can also do it like this:

    SELECT x.MyId, MIN(MinAmt)

    FROM #test

    CROSS APPLY (

    VALUES (MyID, MV1), (MyID, MV2), (MyID, MV3), (MyID, MV4)) x(MyID, MinAmt)

    WHERE MinAmt >= 150

    GROUP BY x.MyID

    I've run some performance...

  • RE: Compare the text in a string (Re-post)

    This is not guaranteed to work in all cases (e.g., where @ may appear outside of an email string) but using Jeff Moden's DelimitedSplit8K string splitter, you can try something...

  • RE: Aggregate Query question

    dwain.c (6/22/2012) Did you check to see if this solution is any faster?

    To answer my own question:

    CPU ...

  • RE: Generating n-Tuples with SQL

    chris.stuart (5/17/2012)


    I always enjoy reading the articles, but this one got me a bit stumped. Where would you actually use this?:unsure:

    To Chris and all the folks out there that took...

  • RE: Concatenate Rows Into Columns with date range criteria

    rgldiatr (6/22/2012)


    rgldiatr (6/22/2012)


    Another question. In your first CTE you have a cross apply:

    CROSS APPLY (SELECT StartDt + n FROM Tally WHERE EndDt >= StartDt + n) x(date2)

    What is the "x(date2)"...

  • RE: Function to check each colum and return result

    Sean Lange (6/22/2012)


    SQL_Kills (6/22/2012)


    Hi,

    Thanks for your advice so far and what you have shown me.

    The table you created QuestionFieldsNormalized was what the table originally looked like that when pulling the...

  • RE: Aggregate Query question

    Les Cardwell (6/22/2012)


    Thanks folks. Brilliant! It made mincemeat out of the Route problem. It worked so well though that I'm now tossing it at a much bigger NP problem that...

  • RE: Aggregate Query question

    Les Cardwell (6/22/2012)


    After putting the route issue to bed, I was mulling over how well this performed. So, to escalate its application, I tossed this at the Jan. '98...

Viewing 15 posts - 3,286 through 3,300 (of 3,957 total)