Forum Replies Created

Viewing 15 posts - 3,541 through 3,555 (of 3,957 total)

  • RE: setup t-sql 2008

    niall.baird (5/21/2012)


    dwain.c (5/21/2012)


    niall.baird (5/21/2012)


    ISNULL()

    COALESCE()

    Correct! But in case the OP needs a little further guidance, I offer this:

    I'm just lazy... 😀

    I had actually posted something quite similar recently so it...

  • RE: Data Islands and Gaps - How To

    vinu512 (5/21/2012)


    Nice!!

    Very nice work with the Ordering Dwain. 🙂

    Thank you sir! I did enjoy that one.

  • RE: setup t-sql 2008

    niall.baird (5/21/2012)


    ISNULL()

    COALESCE()

    Correct! But in case the OP needs a little further guidance, I offer this:

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    CREATE PROCEDURE dbo.Update_MyTable

    @keyINT= NULL

    ,@col1VARCHAR(50)= NULL

    ,@col2VARCHAR(50)= NULL

    ,@col3VARCHAR(50)= NULL

    AS

    BEGIN

    SET NOCOUNT ON;

    DECLARE @rc...

  • RE: Why does my SELECT query only return results with "TOP XX" in front of it?

    SQL Kiwi (5/21/2012)


    Unless the guy that wrote the .NET code left, and you don't have source code, I can't think of any good reason to even attempt debugging this. ...

  • RE: Best way to get average duration

    Lynn Pettis (5/21/2012)


    dwain.c (5/21/2012)


    Lynn Pettis (5/21/2012)


    I have run several tests of both over a heap table with 1,000,000 rows of data

    You're starting to sound like Jeff!

    That's a compliment. More...

  • RE: Best way to get average duration

    Lynn Pettis (5/21/2012)


    I have run several tests of both over a heap table with 1,000,000 rows of data

    You're starting to sound like Jeff!

    That's a compliment. More people should take...

  • RE: Best way to get average duration

    Sigh! If you're jobs are running over 24 hours, you could use this instead.

    ;WITH CTE (jobid, rd, hh, mm, ss) AS (

    SELECT jobid, run_duration

    ,run_duration / 10000 % 100, run_duration...

  • RE: Best way to get average duration

    Right. I did say mine only works if the run time does not exceed 24 hours.

    For the sake of the OP, we should hope that it does not. 😛

  • RE: How to check if a comma seperated column contains the desired word

    If you're trying to join the two tables based on common names, you can also use PATINDEX.

    Create table #basetable(Id int identity, Component varchar(256))

    Create table #dailytable(ID Int, FILENAME Char(50), PROCESS Char(50))

    insert...

  • RE: Best way to get average duration

    Just for fun:

    create table #jobhistory (jobId INT, run_duration int)

    insert into #jobhistory

    select 1,3 union all select 1,31003

    union all select 1,233 union all select 2,5 union all select 2,101

    ;WITH CTE...

  • RE: Data Islands and Gaps - How To

    I'm not sure exactly if this fits the definition of islands and gaps because you seem to have complete data for each minute of time interval.

    This approach should work if...

  • RE: How to substract from one column to another ?

    vinu512 (5/21/2012)


    Looks good Dwain.

    But, I'm still unsure what the OP wants....so will say something after the OP elaborates upon the requirement a little. 🙂

    Actually, not so good. Got sloppy...

  • RE: How to substract from one column to another ?

    I think this can be simplified.

    DECLARE @t TABLE

    (Card_No int, CheckIn DateTime, CheckOut DateTime, Duration int)

    Insert Into @t

    Select 144,'2012-05-17 10:01:34.000','2012-05-17 10:19:57.000',18

    Union ALL Select 144,'2012-05-16 10:14:12.000','2012-05-16 18:51:58.000',517

    Union ALL Select...

  • RE: difference between last(max) and penultimate(max-1) for each group

    Cadavre (5/21/2012)


    Think you forgot to do some casting there. . .

    Didn't forget, just didn't do.

    It was unclear to me if the OP wanted to actually subtract the rows or display...

  • RE: difference between last(max) and penultimate(max-1) for each group

    Lot's of JOINs and APPLYs in the house.

    I'd do it with a subquery because it looks easier on the eyes.

    DECLARE @t TABLE (Col1 char(1), Col2 int )

    Insert Into @t

    Select...

Viewing 15 posts - 3,541 through 3,555 (of 3,957 total)