Forum Replies Created

Viewing 15 posts - 841 through 855 (of 2,171 total)

  • RE: Pivot... I don't think it's possible...

    Riding JW's solution...

    --Peso 3

    SELECTp.Company,

    p.[Year],

    COALESCE(p.Amt1, 0.0) As [Q1 Amt],

    CAST(COALESCE(p.Qty1, 0) AS INT) As [Q1 Qty],

    COALESCE(p.Amt2, 0.0) As [Q2 Amt],

    CAST(COALESCE(p.Qty2, 0) AS INT) As [Q2 Qty],

    COALESCE(p.Amt3, 0.0) As [Q3 Amt],

    CAST(COALESCE(p.Qty3, 0) AS...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Pivot... I don't think it's possible...

    SQL Profiler

    CPU Dur Reads

    ---- ----- -----

    Jeff ...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Pivot... I don't think it's possible...

    -- Peso 2

    SELECTp.Company,

    p.[Year],

    COALESCE(p.Q1Amount, 0.0) AS [Q1 Amt],

    CAST(COALESCE(p.Q1Quantity, 0) AS INT) AS [Q1 Amt],

    COALESCE(p.Q2Amount, 0.0) AS [Q2 Amt],

    CAST(COALESCE(p.Q2Quantity, 0) AS INT) AS [Q2 Amt],

    COALESCE(p.Q3Amount, 0.0) AS [Q3 Amt],

    CAST(COALESCE(p.Q3Quantity, 0) AS INT)...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Pivot... I don't think it's possible...

    You didn't dare to post the question on "the other forum"? 😀

    Here is a single-query suggestion with only one PIVOT operator.

    SELECTp.Company,

    p.[Year],

    COALESCE(p.[Q1 Amt], 0) AS [Q1 Amt],

    CAST(COALESCE(p.[Q1 Qty], 0) AS INT)...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: finding groups of related data

    Not that goodlooking but it will do the job.

    DECLARE@Items TABLE (RowID INT IDENTITY(1, 1), Item1 CHAR, Item2 CHAR)

    INSERT@Items

    SELECT'D', 'Q' UNION ALL

    SELECT'A', 'E' UNION ALL

    SELECT'B', 'F' UNION ALL

    SELECT'C', 'A' UNION ALL

    SELECT'C',...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: finding groups of related data

    What will then happen when you add the sample data

    SELECT'D', 'Q' UNION ALL

    and remove the sample data

    SELECT'A', 'D' UNION ALL

    The graph then looks like

    A D...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: finding groups of related data

    Is this a correct interpretation of your original sample data?

    A - D

    / E C - Q

    |

    ...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: how to fine Server IP

    See http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=105157


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: set @.. = select case when help

    SELECT@UAP = COALESCE(dbo.tlbUAP.[Percent], dbo.tlbUAP.UAPValue)

    FROMdbo.tlbUAP

    INNER JOINdbo.tlbChange ON dbo.tlbChange.ChangeID = dbo.tlbUAP.ChangeID

    INNER JOINdbo.tlbWBS ON dbo.tlbWBS.ChangeID = dbo.tlbChange.ChangeID

    INNER JOINdbo.ThreePointEstimate ON dbo.ThreePointEstimate.WBSID = dbo.tlbWBS.WBSID

    WHEREdbo.tlbWBS.WBSID = @WBSID


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: query optimisation

    SELECTa.ContractorCode,

    a.ProjectID,

    a.ProjectName,

    d.ProductName,

    d.ProductType,

    b.ProjectID + b.ProductCode AS Item,

    b.ProductCode

    FROMProjects AS a

    INNER JOINProductAllocation AS b ON b.ProjectID = a.ProjectID

    INNER JOINUserProjectAccess AS c ON c.ProjectID = a.ProjectID

    LEFT JOINProductMaster AS d ON d.ProductCode = b.ProductCode

    WHEREa.StatusOpen =...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Function blows up when used with a timestame starting with a zero

    ALTER FUNCTION dbo.convertFloatDate

    (

    @date float

    )

    RETURNS DATETIME

    AS

    BEGIN

    RETURN CAST(STUFF(STUFF(STUFF(STR(@date, 14), 13, 0, ':'), 11, 0, ':'), 9, 0, ' ') AS DATETIME)

    END


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Function blows up when used with a timestame starting with a zero

    ALTER FUNCTION dbo.convertFloatDate

    (

    @date float

    )

    RETURNS VARCHAR(20)

    AS

    BEGIN

    RETURN STUFF(STUFF(STUFF(STR(@date, 14), 13, 0, ':'), 11, 0, ':'), 9, 0, ' ')

    END


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Serial date returns different dates in SLServer vs Excel?

    So if you want to keep dateserials, just add 2 to excels dateserial value and you're set.

    Or convert excel dateserial back to date, export and convert back to dateserial.


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Serial date returns different dates in SLServer vs Excel?

    Date "Zero" for SQL Server is 1900-01-01

    Date "Zero" for MS Access is 1899-12-30

    That's why there is a two day difference.


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: divide data into partitions

    Since you seems to have the Enterprise Edition, go for the

    CREATE PARTITION FUNCTION over your partitionNr column,

    and have a job that runs nightly to update the partitionNr column...


    N 56°04'39.16"
    E 12°55'05.25"

Viewing 15 posts - 841 through 855 (of 2,171 total)