Forum Replies Created

Viewing 15 posts - 5,956 through 5,970 (of 7,597 total)

  • RE: Filtered index with IS NULL predicate

    If you do many lookups by ManagerID, you'd likely be able to avoid messing with all this by clustering the table differently:

    CREATE TABLE Employees (

    ID INT...

  • RE: Returning multiple TOP records?

    You should also be able to use a CROSS APPLY to a "SELECT TOP (1) ..." to get the most recent row for any given user.

  • RE: Help!!!

    I want to be a successful DBA someday and hopefully can write sql scripts without looking or using BOL. 🙂

    I've been a SQL Server DBA for 13+ years and I...

  • RE: Find Max value for distinct account number from two Tables

    SELECT

    COALESCE(t1.Account, t2.Account) AS Account,

    MAX(Date) AS Date

    FROM (

    SELECT Account, MAX(Date) AS Date

    FROM dbo.table1

    ...

  • RE: Index Fragmentation?

    The single biggest factor in overall query performance is getting the best clustered index on each table (hint: it's rarely an identity column). Typically you'd start with a higher...

  • RE: Purging data from Master and 5 child tables

    I'm virtually certain the tables are clustered improperly. That should be fixed before you do the partitioning. It's even possible you won't need to partition if you put...

  • RE: Stored Procedure Performance

    You can, and definitely should, avoid converting cStaging.cDate if you can.

    --if "cDate" is a datetime column:

    --instead of this:

    --WHERE (CONVERT(DATE, cStaging.cDate) BETWEEN @startdate AND @endDate) AND (CONVERT(DATE,...

  • RE: Stored Procedure Performance

    sqldriver (7/5/2014)


    TheSQLGuru (7/1/2014)


    create index ix_Split_1 on #Split_1 (NewParameter)

    Good call on the joining to a split-built derived table and how putting that into a temp table could make things faster. ...

  • RE: Removal of Selected Indexes/Script Index Create for List of Indexes

    By far the biggest payback is in correcting clustered indexes if the wrong key column(s) were chosen for it. And that alone often allows very large numbers of other...

  • RE: Good practice to separate tables with static data?

    I also make the doc tables "live". That is, the code that created/initialized/set up a new db should use the "documentation" table to determine whether the table is static...

  • RE: TSQL Short-circuit

    TheSQLGuru (7/2/2014)


    ScottPletcher (7/2/2014)


    TheSQLGuru (7/1/2014)

    Very few things in SQL Server land can/will short-circuit.

    I think that's over-stated. Most optimizers will short-circuit when they safely can. Presumably later versions of...

  • RE: Removal of Selected Indexes/Script Index Create for List of Indexes

    You did review the stats SQL Server provides on index usage and missing indexes before you made your changes, right?

    Edit: What indexes you think SQL will need/use and what indexes...

  • RE: TSQL Short-circuit

    TheSQLGuru (7/1/2014)

    Very few things in SQL Server land can/will short-circuit.

    I think that's over-stated. Most optimizers will short-circuit when they safely can. Presumably later versions of the optimizer...

  • RE: Good practice to separate tables with static data?

    I wouldn't want to put them in a separate schema unless you really had to. Aside from hideous renaming issues (*), you might end up with what seems like...

  • RE: Need to resume code execution efter error

    If you want to keep/commit previous activities in the loop, you likely need to explicitly BEGIN and COMMIT a tran for each loop, something like this:

    WHILE ...

    BEGIN

    ...

Viewing 15 posts - 5,956 through 5,970 (of 7,597 total)