Forum Replies Created

Viewing 15 posts - 3,601 through 3,615 (of 4,085 total)

  • RE: what component should I use ?

    Here is a sample of the batch file. You have to specify the server and database separately, so the IF statement is setting up different environment variables for each.

    if...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: UNION or other way to extract data?

    This will also give you the correct results. I suspect it might be more efficient than having the two separate subqueries, but haven't had a chance to test it.

    SELECT...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: what component should I use ?

    mw112009 (9/26/2011)


    Sir

    We have 6 servers and I have to deploy many stored procs in each of these servers. Doing them manually is a pain. Besides I run into situations where...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: UNION or other way to extract data?

    Your English statement of the criteria does not match the expected results. Transaction_IDs 1-8 all have an instance of Type A, so they should all be included in your...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Multiple Records / Max Date with a Twist

    As I suggested earlier, you probably want to use a CTE with Row_Number()

    WITH POLineItems AS (

    SELECT A.OrdN03

    ...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Using Case and NULL values

    You just need to use slightly different syntax.

    SELECT p.escProduct AS ep, count(*) as totEsc,

    CASE WHEN o.ocDateClosed IS NULL THEN

    avg(DATEDIFF(DAY, o.ocDateOpened, GETDATE()))

    ELSE avg(DATEDIFF(DAY, o.ocDateOpened, o.ocDateClosed))

    End AS 'srAge'

    FROM tblocMain o INNER JOIN...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Needed help to convert column as row values

    What you're asking to do violates basic principles of database design. Why do you need to do this?

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: date time format conversion

    HowardW (9/22/2011)I also fundamentally disagree that the purpose of documentation isn't to be accurate.

    No one said that it wasn't the goal. What I was trying to say is that...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Count with Group By clause

    This should give you what you need. It's not tested.

    SELECT OrgID, Count(IndID)

    FROM Individuals AS i

    CROSS APPLY(

    SELECT TOP (1) OrgID

    FROM Transactions AS t

    WHERE t.IndID = i.IndID

    ORDER BY TranID

    ) AS t

    GROUP...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Multiple Records / Max Date with a Twist

    You don't need to supply a real datetime for the 99999999. Min() and Max() will only return NULL if all of the values are NULL, but that's what you...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Joining, but need to find the row with the min values in it

    With appropriate indices, a CROSS/OUTER APPLY should perform better, but you should test it with your actual data. An OUTER APPLY corresponds to the LEFT JOIN that you are...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: date time format conversion

    HowardW (9/21/2011)

    Maybe I'm misreading, or is this a mistake in BOL? (you'd think not for the amount this article is used)

    Manuals are not technical specs nor are they gospel. ...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Subquery returned more than 1 value.

    duanecwilson (9/21/2011)


    I had been working on a larger query that surrounded this one

    In that case, you might consider using a CROSS APPLY instead of Max().

    SELECT DayKey, Port_ID

    FROM <<Main Query>>

    CROSS APPLY...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: date time format conversion

    HowardW (9/21/2011)


    The style parameter has nothing to do with converting a varchar/char to a datetime.

    You might want to recheck your facts. BOL says differently:

    http://msdn.microsoft.com/en-us/library/ms187928.aspx


    Input when you convert to datetime;...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: iTVF: Better way to code this?

    Pam Brisjar (9/21/2011)


    Drew: Your solution, unfortunately, didn't work. Seems like a select statement in a CASE isn't allowed.

    Actually a SELECT statement should be allowed as long as it only...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 3,601 through 3,615 (of 4,085 total)