Forum Replies Created

Viewing 15 posts - 5,206 through 5,220 (of 14,953 total)

  • RE: 'Pretty-up' the code

    I would almost certainly do this using Union All instead of Joins.

    select Col1, Col2, Col3

    from TableA

    union all

    select Col1, Col2, Col3

    from TableB

    union all

    ... and so on through the tables...

    You can add...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Does It Count?

    I would definitely include scheduled downtime as downtime.

    If backup servers, etc., can keep things up for customers/employees/etc., then it's not downtime for the database, which is what really matters. ...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: need help to select rows

    You're welcome.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: DML Triggers - 1 For All or All for 1?

    Yes, it's currently defined as adequate to know that a change was made. What happens if a row is changed five times in two minutes by four different people?

    I'm...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: DML Triggers - 1 For All or All for 1?

    Like Gail, I'd be inclined to split the triggers up. SQL Server will want to have execution plans for them, and multiple internal branches generally result in expensive plans....

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: need help to select rows

    ;WITH MaxDates (OrderID, MaxDate) AS

    (SELECT OrderID, MAX(OrderDate)

    FROM MyTable

    GROUP BY OrderID)

    SELECT T1.*

    FROM MyTable AS T1

    LEFT JOIN CTE

    ON T1.OrderID = CTE.OrderID

    AND T1.OrderDate = CTE.MaxDate

    WHERE CTE.OrderID IS NULL;

    The "CTE" (Common Table Expression) picks...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Question On Returning The Earliest Date

    select EmpID, min(Date)

    from MyTable

    group by EmpID;

    Does that do what you need?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: need help to select rows

    What's the "max order date"? Is that a column in a table? A variable? An input parameter?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Placing tempdb files on a diffrent drive.

    You can, but it's not necessarily going to benefit you. The 1-file-per-CPU thing is more of an urban legend than a valid solution, in many/most cases.

    Check this for details:...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Exporting Fixed width files

    You have to change to Ragged Right instead of Fixed Width. Fixed Width is for mainframe output, which doesn't use row delimiters.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Export queries output to different worksheets of the same Excel file

    SSIS does this easily. You specify which sheet to export to in your Excel Destination object in a Data Flow definition.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: "Query Designer" JOIN Magic SSMS 2008

    On the question about Query Designer, no. Microsoft pretty routinely hides their code.

    It wouldn't be that hard to take an execution plan and turn it into a query in...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: mixing numeric and text data in a single column

    You can break up queries like that by doing the IsNumeric query to populate a temp table, then doing the rest of the action on the temp table, or by...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Are the posted questions getting worse?

    Brandie Tarvin (1/27/2011)


    Is anyone here a member of itSMF?

    If so, what are your thoughts on the organization?

    My employer is sponsoring membership and I'm trying to figure out whether it's worth...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Are the posted questions getting worse?

    GilaMonster (1/26/2011)


    Stefan Krzywicki (1/26/2011)


    Where the hell did January go? I think it might have been buried in snow and I missed it.

    Wasn't the snow. I missed most of it too,...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 15 posts - 5,206 through 5,220 (of 14,953 total)