Forum Replies Created

Viewing 15 posts - 1,966 through 1,980 (of 3,957 total)

  • RE: Calculating a Moving Average

    mpdillon (2/12/2013)


    ChrisM and DwainC,

    Thank you for the reference. I had actually seen that before. I used it as best I could. But since it didn't use the lookup table, I...

  • RE: Want one values with similar ids

    Something like this then:

    ;WITH Trans (ID, TransactionAmt) AS (

    SELECT '1',20000 UNION ALL

    SELECT '1',30000 UNION ALL

    SELECT '2',40000 UNION ALL

    SELECT '2',20000 UNION ALL

    SELECT '2',20000 UNION ALL

    SELECT...

  • RE: Tally OH! An Improved SQL 8K “CSV Splitter” Function

    Note that I posted the query plan in my previous post in case someone wants to take a shot at that analysis.

  • RE: Tally OH! An Improved SQL 8K “CSV Splitter” Function

    Steven Willis (2/11/2013)


    Steven Willis (2/11/2013)


    ...I can't guess what effect this would have on performance of the function.

    I was wondering about that! Thanks for doing the proof testing.

     

    I would love...

  • RE: Last Sunday of a month in sql

    Apparently changing the language from english to spanish changes the @@DATEFIRST value from 7 to 1.

    I didn't realize that side-effect. Interesting...

    It also accounts for why I didn't see it...

  • RE: Comparing figures based on relative date

    ChrisM@Work (2/11/2013)


    Something like this?

    DROP TABLE #mytable

    CREATE TABLE #mytable

    (P_KEY INT IDENTITY(1,1) PRIMARY KEY CLUSTERED,

    LAST_DAY_OF_MONTH...

  • RE: Want one values with similar ids

    Another shot in the dark. Maybe the OP wants the minimum amount from unique transactions for each ID?

    ;WITH Trans (ID, TransactionAmt) AS (

    SELECT '1',20000 UNION ALL

    SELECT '1',30000...

  • RE: Neew T-SQL for setting date

    Lynn Pettis (2/11/2013)


    briancampbellmcad (2/11/2013)


    UPDATE [tblTransactions] SET [AllocatedDate] = ........

    Basically I need to set AllocatedDate to "Today" using something like "Now" or "Now()"... any ideas? Thanks!

    UPDATE [tblTransactions] SET [AllocatedDate] =...

  • RE: Clock-In/ Clock-Out

    p.ramchander (2/11/2013)


    dwain.c (2/11/2013)


    No idea because I don't know what Day 01, Day 02, etc. are supposed to represent.

    ;WITH Punches AS (

    SELECT *

    ...

  • RE: Tally OH! An Improved SQL 8K “CSV Splitter” Function

    Sean Lange (2/11/2013)


    ahpitre (2/11/2013)


    How can I use this function to search for more than 1 character? I have data that is delimited by either a comma or semicolon (,;). Need...

  • RE: Last Sunday of a month in sql

    Michael Valentine Jones (2/11/2013)


    dwain.c (2/11/2013)


    If you don't like magic numbers, I think you can do it this way too:

    select

    a.DT,

    LastDayofMonth = dateadd(mm,datediff(mm,-1,a.DT),-1),

    LastSundayofMonth =

    dateadd(dd,(datediff(dd,'17530107',dateadd(mm,datediff(mm,-1,a.DT),-1))/7)*7,'17530107'),

    DwainsWay =

    ...

  • RE: Clock-In/ Clock-Out

    No idea because I don't know what Day 01, Day 02, etc. are supposed to represent.

  • RE: Clock-In/ Clock-Out

    MAX(day_value)-DATEDIFF(minute,MIN(punchTime), MAX(punchTime))/60.

  • RE: Clock-In/ Clock-Out

    p.ramchander (2/11/2013)


    I agree with you vinu. Dwain's logic is very nice and simple. Thanks Dwain for your time and help. I replaced the logic with your's.

    Now, I created a table...

  • RE: tricky many to many query

    kevin 20860 (2/11/2013)


    thank you. I had something similar to that so was heading in the right direction but as they say the devil is in the details.

    I'll check it...

Viewing 15 posts - 1,966 through 1,980 (of 3,957 total)