Forum Replies Created

Viewing 15 posts - 3,211 through 3,225 (of 10,144 total)

  • RE: Help finding a date

    Rog Saber (6/24/2014)


    Here is what I tried but I believe I am still having an issue. If I put the duration at 120 minutes it returns:

    time_sched_start_dtenddt

    2014-06-23 09:15:00.0002014-06-23 11:30:00.000

    I don't want...

  • RE: Running total error

    Here's a quick rejig of that sample data, and a reformat of the code. Is it only the running total column which is incorrect?

    IF OBJECT_ID ('tempdb..#GLT') IS NOT NULL DROP...

  • RE: Help finding a date

    Sachin Nandanwar (6/24/2014)


    ChrisM@Work (6/24/2014)


    With a duration of 20, this returns an incorrect timeslot (2014-06-23 08:30:00.000 - 2014-06-23 09:15:00.000)

    No it returns

    (2014-06-23 09:15:00.0002014-06-23 10:00:00.000)

    Try also DECLARE @duration INT = 120, which...

  • RE: Help finding a date

    Sachin Nandanwar (6/24/2014)


    ChrisM@Work (6/24/2014)


    With a duration of 20, this returns an incorrect timeslot (2014-06-23 08:30:00.000 - 2014-06-23 09:15:00.000)

    No it returns

    (2014-06-23 09:15:00.0002014-06-23 10:00:00.000)

    Sorry, my mistake, I extended the dataset to...

  • RE: Help finding a date

    DECLARE @duration INT=20

    SELECT TOP 1

    time_sched_start_dt = MAX(CASE WHEN dir = 'S' THEN dt END),

    time_sched_end_dt = MAX(CASE WHEN dir = 'E' THEN dt END)

    FROM ( -- f

    SELECT dir, dt, Grouper...

  • RE: Help finding a date

    Sachin Nandanwar (6/24/2014)


    The query is purely based on the sample data provided and all the assumptions stated in the earlier posts.

    See if this helps.

    DECLARE @duration INT=70

    SELECT TOP 1 time_sched_start_dt,

    ...

  • RE: Update Part of a SQL field with charindex

    Sachin Nandanwar (6/24/2014)


    You can use REPLACE function as well.

    declare @str as table( val varchar(20))

    insert @str

    select '12-FLA-2-02'

    declare @update varchar(20)='11111'

    select * from @str

    update @str set val=replace(val,LEFT(val, CHARINDEX('-', val)-1) ,@update)

    select * from @str

    You...

  • RE: Are the posted questions getting worse?

    Koen Verbeeck (6/23/2014)


    😎 13000th point 😎

    Also went over 9000 forum posts a while back. :w00t:

    Top work geezer, most of 'em are pretty darned good posts too.

  • RE: Help\Advice on building a query

    No worries, thanks for the feedback. You'll find some discussion of the method and a link to IBG's original code here.

  • RE: Apology for today's article

    Koen Verbeeck (6/23/2014)


    chrisn-585491 (6/23/2014)


    So, yeah... Sad...

    Sad is the word. Sadder still is that at my work a colleague had a bet to guess the background of the author... 🙁

    Unfortunately,...

  • RE: Case Where Clause for Datetime from Varchar field

    -- Simplify THE query using (CROSS) APPLY:

    select case

    when cs.COMMENT like '%CED:%' and DateFilter > convert(varchar(10),getdate(),103) then DateFilter

    when cs.COMMENT like '%CED:%' and DateFilter <= convert(varchar(10),getdate(),103) then DateResult

    when cs.COMMENT not...

  • RE: Just curious, what are your SQL pet peeves ?

    andrew gothard (6/20/2014)


    Ed Wagner (6/20/2014)


    andrew gothard (6/20/2014)


    Ed Wagner (6/19/2014)


    andrew gothard (6/19/2014)


    below86 (6/18/2014)


    andrew gothard (6/18/2014)


    below86 (6/16/2014)


    andrew gothard (6/15/2014)


    Koen Verbeeck (6/14/2014)


    Badly phrased, sorry. In a column that should be a date,...

  • RE: Running total error

    pwalter83 (6/23/2014)


    ChrisM@Work (6/23/2014)


    Paul, you have two threads open which cover the same problem. Can I suggest you choose one of them and close the other? You can do that by...

  • RE: Running total error

    Paul, you have two threads open which cover the same problem. Can I suggest you choose one of them and close the other? You can do that by posting something...

  • RE: Running total error

    pwalter83 (6/23/2014)


    ChrisM@Work (6/23/2014)


    pwalter83 (6/23/2014)


    ... I need to use the following query to get the desired resultset. I think that is where the problem is

    If the query you "need to use"...

Viewing 15 posts - 3,211 through 3,225 (of 10,144 total)