Forum Replies Created

Viewing 15 posts - 5,581 through 5,595 (of 7,608 total)

  • RE: Select All matches that clubs played with an interval less than three days between games

    SELECT DISTINCT m1.*

    FROM Matches m1

    WHERE

    EXISTS(

    SELECT 1

    FROM Matches m2

    ...

  • RE: Convert Integer to Time

    SELECT time_int, CAST(DATEADD(MINUTE, time_int / 100 * 60 + time_int % 100, 0) AS time) AS time

    FROM (

    SELECT 0 AS time_int UNION ALL

    ...

  • RE: Index Seek not happening

    If you (almost) always do lookups on the table based on "businessid", then cluster the table on businessid. If you need to keep the PK, make the PK nonclustered...

  • RE: SQL Date Parameters not working

    BWFC (12/4/2014)


    ScottPletcher (12/3/2014)


    BWFC (11/27/2014)


    You're welcome.

    One other thing, be careful using BETWEEN for date range queries. You're usually better using

    where

    [Date] >= @startdate

    and

    [Date] <= @enddate

    Have a look at...

  • RE: database growth

    If you're not using service broker any more, then it's 100% safe to run this:

    ALTER DATABASE msdb SET NEW_BROKER

    which should clear that table and allow you to release the space.

  • RE: SQL Date Parameters not working

    BWFC (11/27/2014)


    You're welcome.

    One other thing, be careful using BETWEEN for date range queries. You're usually better using

    where

    [Date] >= @startdate

    and

    [Date] <= @enddate

    Have a look at this...

  • RE: Prevent a SELECT Query from returning results using LOCKS

    To avoid rows already being modified, you can use the READPAST hint. That's often used for work-queue-type processing. If you can use that, there's no good reason to...

  • RE: database growth

    Ok, let's see what this shows:

    IF OBJECT_ID('tempdb.dbo.#showfilestats') IS NOT NULL

    DROP TABLE #showfilestats

    CREATE TABLE #showfilestats (

    Fileid smallint NOT NULL,

    FileGroup...

  • RE: database growth

    417 pages is a trivial size, you can ignore it if that's the total.

    Does "DB size shows 215 GB" include log file? If so, what size is the log...

  • RE: Puzzle with Sproc intermittently runs slow but runs faster other days.

    I suggest RECOMPILE as well. That may take some time, but it will be trivial compared to a terrible plan.

    Also, if you leave auto stats update on, explicitly set...

  • RE: database growth

    SQL also creates internal tables for certain types of data, including: primary XML indexes,

    service broker, change tracking and a few other things. You'll need to include the size...

  • RE: Baffling query plan on slow query

    Robert Frasca (12/2/2014)


    Grant Fritchey (12/2/2014)


    ScottPletcher (12/2/2014)


    Robert Frasca (12/2/2014)


    ScottPletcher (12/2/2014)


    Robert Frasca (12/2/2014)


    ScottPletcher (12/1/2014)


    I guess the SourceFactTimeCard table is fairly wide?

    I suggest creating a covering index on:

    SourceFactTimeCard (...

  • RE: Baffling query plan on slow query

    Robert Frasca (12/2/2014)


    ScottPletcher (12/2/2014)


    Robert Frasca (12/2/2014)


    ScottPletcher (12/1/2014)


    I guess the SourceFactTimeCard table is fairly wide?

    I suggest creating a covering index on:

    SourceFactTimeCard ( TimecardIndex, EmployeeID )

    If SQL then...

  • RE: SQL DBA knowing user passwords

    eric.notheisen (12/2/2014)


    In our company sharing user passwords is a firing offense. As developers needing to troubleshoot user defined defects, we restore the production database to our development VM's and...

  • RE: Baffling query plan on slow query

    Robert Frasca (12/2/2014)


    ScottPletcher (12/1/2014)


    I guess the SourceFactTimeCard table is fairly wide?

    I suggest creating a covering index on:

    SourceFactTimeCard ( TimecardIndex, EmployeeID )

    If SQL then uses that covering...

Viewing 15 posts - 5,581 through 5,595 (of 7,608 total)