Forum Replies Created

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

  • RE: string columns containing alphanumeric

    SELECT Section

    FROM #temp

    ORDER BY

    SIGN(PATINDEX('%[a-zA-Z]%',Section)) ASC,

    CAST('0'+LEFT(Section,PATINDEX('%[a-zA-Z]%',Section+'A')-1) as int) DESC,

    RIGHT(Section,LEN(Section)-(PATINDEX('%[a-zA-Z]%',Section+'A')-1)) ASC

  • RE: Are the posted questions getting worse?

    Jeff Moden (8/24/2015)


    I've written all my own such as sp_ShowWorst and sp_WhatsRunning...

    Care to share 🙂

  • RE: Are the posted questions getting worse?

    Sean Lange (8/20/2015)


    ...Obvious they have absolutely no idea how the current query works at all.

    About sums me up with queries I write :hehe: 😀

    Does that mean you won't help me...

  • RE: Are the posted questions getting worse?

    Sean Lange (8/19/2015)


    Thanks. Shouldn't be too bad. This is a super simple process. No need for the "T" portion. Just need to truncate a staging table and pull data from...

  • RE: CURSOR LOOP

    Koen Verbeeck (8/6/2015)


    What's this cursor thing? 😀

    It's the precursor to a pork chop launcher 😛

  • RE: Select Query Help

    SELECT ISNULL(Month,'TOTAL'),Resource,DepDate,SUM(Increase),SUM(Proj_Bkd),SUM(Vol_Target),SUM(Difference_B_T),SUM(Difference_Proj_T),SUM(Perc_Bkd_Trgt),SUM(Final_Prev_Year),SUM(Booked_SDL),SUM(Perc_Booked_To_Final)

    FROM temp

    GROUP BY Month,Resource,DepDate

    WITH ROLLUP

    HAVING (GROUPING(Resource) = 0 AND GROUPING(DepDate) = 0) OR GROUPING(Month) = 1

    ORDER BY GROUPING(Month) ASC,DepDate ASC

  • RE: TSQL PatIndex

    PATINDEX('% [2] %', ' ' + Marketing_Special_Attributes + ' ')

    will give you char position in the string

    or zero if not found

  • RE: Help with a subquery in a CASE and a JOIN

    Why are you using a subquery?

    SELECTZIF19_ACCDOC_H_T.GJAHR,ZIF19_ACCDOC_H_T.MONAT,HWAER,UKURS

    ,UseRate = CASE WHEN UKURS = 0 THEN 1 / dbo.MonthlyExRates.Rate

    ELSE dbo.ZIF19_ACCDOC_H_T.UKURS END

    FROMdbo.ZIF19_ACCDOC_H_T

    JOIN dbo.MonthlyExRates

    ON ZIF19_ACCDOC_H_T.GJAHR = dbo.MonthlyExRates.GJAHR

    AND ZIF19_ACCDOC_H_T.MONAT = dbo.MonthlyExRates.MONAT

    AND...

  • RE: =COUNT(SWITCH Query

    =Sum(Switch(

    Fields!Operating_System.Value = "Microsoft Windows 7 Workstation" and Fields!Version.Value = "11",1,

    Fields!Operating_System.Value = "Microsoft Windows Server 2008 R2" and Fields!Version.Value = "11",1,

    Fields!Operating_System.Value = "Microsoft Windows Server 2008 SP2" and Fields!Version.Value = "9",1,

    Fields!Operating_System.Value...

  • RE: Expression needs a false argument, please can you help?

    Your outermost IIf does not have a value for false, you must supply one

    What does the ultimate result of 0 or 1 represent?

    What value do you want to return if...

  • RE: Are the posted questions getting worse?

    And from ten years ago!

    Don't forget good procedure

    DROP Dirty_Nappy

    GO

    SELECT Clean_Nappy FROM Nappy_Pile WHERE COUNT(Clean_Nappy) > 0

    INSERT Baby INTO Clean_Nappy

    GRANT ALL Smiles to Baby

    GO

    And the mandatory function

    CREATE FUNCTION Daddys_Turn ()

    ...

  • RE: Are the posted questions getting worse?

    Congratulations, Alan 🙂

  • RE: Error using "Update" and "Set" commands

    Why do you select data first and then update?

    If you want details of rows updated add OUTPUT clause to the update statement

  • RE: Bulk insert from Excel

    That looks like a standard update to me, something like this

    UPDATEp

    SETp.A = t.A,

    p.B = t.B

    FROMdbo.products p

    JOIN dbo.temp t

    ON t.productid = p.productid

    If you need to add new rows as well then...

  • RE: joining two select queries results in one row

    stevefromOZ (6/12/2015)


    ahh but David, Surname is in table2 not table1. How would we get the value from table2 instead? :hehe:

    Deliberate mistake 😛

    😀

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