Forum Replies Created

Viewing 15 posts - 2,476 through 2,490 (of 10,144 total)

  • RE: Rewriting the Sql code

    Jeff Moden (6/3/2015)


    Alvin Ramard (6/3/2015)


    ChrisM@home (6/3/2015)


    GilaMonster (6/3/2015)


    What, other than the NOLOCK hints, is the problem?

    The OP is confused by the location of the ON clauses. Since there are only INNER...

  • RE: Avoid LEFT join

    mohanaprabhu.v (6/4/2015)


    SELECT tblInvoice.*, tblCustomer.FirstName + SPACE(1) +

    tblCustomer.LastName as CustomerName FROM tblInvoice WITH(NOLOCK)

    LEFT JOIN tblCustomer WITH(NOLOCK) ON tblInvoice.CustomerNo = tblCustomer.CustomerNo

    please help us to improve this query performance level without...

  • RE: Writing Better T-SQL: Top-Down Design May Not be the Best Choice

    Nice thought-provoking article SQLMickey. Here's a thought for you:

    "Let’s take a look at a stored procedure query written four different ways."

    Whilst a junior developer might select one of the four...

  • RE: Get Work system - avoid duplicate inserts

    There are many impediments to performance in your query. You want it to run as quickly as possible. Test this as a functional equivalent.

    ;

    WITH TheChosenOne AS (

    SELECT TOP 1...

  • RE: Date/Time Calculations for Workplan times

    -- Sample data setup

    drop TABLE #StaffHours

    CREATE TABLE #StaffHours (RecID INT, StaffID INT, StartDate DATETIME, EndDate DATETIME)

    INSERT INTO #StaffHours (RecID, StaffID, StartDate, EndDate) VALUES

    (17,969,'2015-05-18 00:00:00.000','2015-05-18 06:00:00.000'),

    (18,969,'2015-05-18 18:00:00.000','2015-05-19 06:00:00.000'),

    (19,969,'2015-05-19 18:00:00.000','2015-05-20 06:00:00.000'),

    (20,969,'2015-05-20 18:00:00.000','2015-05-21...

  • RE: Need Help with Column Grouping

    ;

    WITH SalesPerEmp AS (

    SELECT

    e.firstname + N' ' + e.lastname AS FullName,

    COUNT(*) AS TotalOrders

    FROM dbo.Employees e

    INNER JOIN Sales.Orders o

    ON e.empid = o.empid

    GROUP BY e.firstname + N' ' + e.lastname

    )

    SELECT...

  • RE: Get Work system - avoid duplicate inserts

    Some ideas here[/url]. As Gianluca says, difficult to tell what is going wrong with no code. Your statement could be something like this:

    UPDATE UnassignedWork

    SET unassigned = 1

    OUTPUT

    INSERTED.column1,...

  • RE: Tuning expensive query III

    WhiteLotus (5/28/2015)


    Hi All,

    I am tuning this query ( Please see the bottom query)

    <<snip>>

    Please help how to optimize it .. Really appreciate it

    Cheers

    Optimising performance of queries is much easier if...

  • RE: Are the posted questions getting worse?

    Ed has the crystal ball today, plus nerves of steel and the patience of a person with a tent guarded by a hippo..

  • RE: INSERT INTO not inserting enough rows

    richardmgreen1 (5/28/2015)


    Hi Chris

    I'll take all the help I can get (I'm always willing to learn).

    I still don't understand why (without any changes) I could select 53 records last week and...

  • RE: INSERT INTO not inserting enough rows

    richardmgreen1 (5/28/2015)


    Hi Sean

    It's quite a monster select statement that normally runs quite happily (or so we thought).

    You're basically correct. When the select runs on it's own for some records...

  • RE: INSERT INTO not inserting enough rows

    richardmgreen1 (5/28/2015)


    Hi Sean

    It's quite a monster select statement that normally runs quite happily (or so we thought).

    You're basically correct. When the select runs on it's own for some records...

  • RE: Are the posted questions getting worse?

    Brandie Tarvin (5/27/2015)


    GilaMonster (5/27/2015)


    Looks like I hit a few nerves with Sunday's editorial....

    Here on the site? Or are you referring to the World Cup convo?

    The Scientific Method. Million-row tests &...

  • RE: optimizing SUM and CASE statements

    Have some kip first 🙂

    This article [/url]describes how to capture and send/attach a .sqlplan file (execution plan export file).

  • RE: optimizing SUM and CASE statements

    Have a look at row 16 of my test set and compare it to your CASE statements.

Viewing 15 posts - 2,476 through 2,490 (of 10,144 total)