Forum Replies Created

Viewing 15 posts - 5,416 through 5,430 (of 49,552 total)

  • RE: adding columns

    Well you shouldn't be using SELECT * in production code. Fix your selects to select just the columns they need in the order they need and then you won't have...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Help Needed

    Since SQL Server doesn't have nested transactions (just syntax which makes you think it does), there's no advantage. A transaction should be as small as possible while still ensuring the...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Table variable in dynamic query

    nidhi.naina (7/2/2015)


    BUt my lead somehow asked me to use table variable 🙁

    Ask him why, given the known performance problems that table variables often cause.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: adding columns

    river1 (7/2/2015)


    I want to add a column as the third of the table, the second column that I want to add needs to be at the fifth place.

    Why?

    The order of...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Are the posted questions getting worse?

    Informal survey before I make a fool of myself in an article (again)

    Do you get the feeling that IT people, especially ones at the top-end of the field, are too...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: MAXDOP and cost threshold for parallelism settings ?

    SQLJay (7/2/2015)


    We have a 2 physical CPUs that are 4 cores each with hyper threading enabled. When looking through the task manager, under the performance tab, I see 16 CPU...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Help with SQL - Calculate time difference for consecutive rows

    I haven't run it (busy packing up at work), but as a guess, do you need a PARTITION BY S_ID in your OVER clauses? At the moment, they're working across...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Table variable in dynamic query

    yb751 (7/2/2015)


    --When you want to do this

    SET @query_from = @query_from + CHAR(10) + ' JOIN ' + @TableVariable + ' on ABC.ID = ' + @TableVariable + '.ID '...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Adventureworks database for SQL Server 2016

    Unlikely there will be an official demo DB until after launch. Features are still changing, we're still in preview. It's no impossible that queries written now won't work come release.

    Use...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Simple SQL Query - Or So I thought.

    Do you understand why and how it works?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: High CXPACKET on a single CPU database instance

    Unless you have a really, really, really old machine there (as in well over 10 years old) or a VM that a single virtual core has been assigned to, you've...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Simple SQL Query - Or So I thought.

    BWFC (7/2/2015)


    At face value, you could try selecting only the columns you actually want to see and using SELECT DISTINCT if the rows are unique.

    Would not be...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Simple SQL Query - Or So I thought.

    mattmacmillan (7/2/2015)


    My table layout is

    Which doesn't help me to test queries that I write 😉

    Something like

    SELECT <stuff>

    FROM Clients c

    WHERE c.idclient IN (SELECT cc.idclient FROM...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Simple SQL Query - Or So I thought.

    Without sample data or a table to test against it's a guess, but you probably want to use an EXISTS or an IN, not a join.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Are the posted questions getting worse?

    jasona.work (7/2/2015)


    If you're not in the US, anything fun going on?

    Regular working day tomorrow, trying to catch up on writing and some presentations over the weekend, maybe some Skyrim too.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 15 posts - 5,416 through 5,430 (of 49,552 total)