Forum Replies Created

Viewing 15 posts - 961 through 975 (of 1,413 total)

  • RE: Selection of Max value from 3 different columns?

    Then we would be pretty sure that the design was probably not the best one. And the performance of the -- admittedly more manageable -- query that PW supplied would...

  • RE: Use bit data type for boolean?

    Yes, 1 byte is always needed to store bit columns, even if there is only one column. However, if there are more than one bit column on a table they...

  • RE: NT User id stamp

    Where do you mean it is displayed?

  • RE: Top 4 Subquery

    Something like this?

    SELECT Address, MAX([Date])

    FROM dbo.foobar

    GROUP BY Address

    UNION ALL

    SELECT foobar.Address, MAX([Date])

    FROM dbo.foobar

    INNER JOIN (

    SELECT Address, MAX([Date]) MaxDate

    FROM dbo.foobar

    GROUP BY Address

    ) exclude

    ON foobar.Address...

  • RE: locking?

    Eh, you misunderstood me. My example code using WAITFOR DELAY was only for getting time to test if an implicit transaction was takingg place or not. Several messages in this...

  • RE: table name from variable

    I'll just add the usual response: http://www.sommarskog.se/dynamic_sql.html

    Everything you need can be found there, including an explanation of why this is normally not a good idea, just as Remi points...

  • RE: locking?

    Ok, thanks for the verification.

  • RE: NT User id stamp

    SUSER_SNAME() returns the name of the login that the user is connected to the database with. If you are using SQL Server authentication it will return the SQL Server login...

  • RE: NT User id stamp

    Use SUSER_SNAME() instead of USER

  • RE: Selection of Max value from 3 different columns?

    >However, if you are stuck with this design, what about one of these?

    ...

    >Result is always : 30

    Yes, they all evaluate to the same execution plan. Which is almost the same...

  • RE: How are logs written?

    It does not work that way. Transactions are written to the log file when they occur, and then written to the data file(s) at 'regular' intervals (during checkpoints). There is...

  • RE: Selection of Max value from 3 different columns?

    True, but at least for this example that would have much worse performance, since it would require three scans as opposed to one.

  • RE: Selection of Max value from 3 different columns?

    And just add the MAX aggregate function around the CASE if that is what you were looking for.

  • RE: Selection of Max value from 3 different columns?

    Is it just for 1 row, or is it the aggregate MAX function you are talking about?

    For 1 row:

    SELECT

    CASE WHEN ScheduleTime1 > ScheduleTime2 THEN

    CASE WHEN...

  • RE: locking?

    Kenneth, could you elaborate on the following?

    >Each delete must be within it's own transaction. As written, all is one giant implicit tran, thus locks and resources would be held for...

Viewing 15 posts - 961 through 975 (of 1,413 total)