Forum Replies Created

Viewing 15 posts - 3,976 through 3,990 (of 49,552 total)

  • RE: sql query

    DECLARE @MaxThought INT;

    SELECT @MaxThought = MAX(thoughtid) FROM TRP_thoughts;

    SELECT * FROM TRP_thoughts WHERE thoughtid = FLOOR(RAND(CHECKSUM(NEWID()))*@MaxThought)+1;

    Should get you a random row each time, and is more efficient than the usual TOP...

    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: 70-462 Exam Practice Lab Ex. 5 Page 50

    Considering that most people here probably aren't familiar with that practice exam, you may want to explain further what you're trying to do, what exactly is failing and what 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: How to repair/recover/restore backup file on SQL sERVER 2012

    Post the checkDB output. Got an older backup?

    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: How to do IN statement as a parameter

    Or use a table-type parameter and use it in an IN subquery

    WHERE ID IN (SELECT ID FROM @TableTypeParameter)

    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: Data integrity job error

    Run the following for each DB, post the full and complete results.

    DBCC CheckDB(<database name>) WITH NO_INFOMSGS, ALL_ERRORMSGS, EXTENDED_LOGICAL_CHECKS, DATA_PURITY

    And maybe change your job to include the NO_INFOMGSG option. The number...

    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: Is the sa account out of fashion?

    The parameter -m starts SQL in single user mode, you can connect with any client tool.

    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: Is the sa account out of fashion?

    feersum_endjinn (12/18/2015)


    I was under the impression local administrators were no longer added as sysadmins by default.

    They're not.

    If you restart SQL in single user mode, then, while SQL is in...

    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: Query choosing bad plan even after running sp_updatestats

    Can you post the query and the 'bad' execution plan?

    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: Insert records that do not exist

    MMartin1 (12/17/2015)


    Does the SELECT 1 provide a big performance gain or just prevents a call to the disk that may get delayed?

    Neither. It's there to show readers that EXISTS...

    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: Give me suggestions for DBA interview

    Be honest. Don't exaggerate your experience. Don't claim familiarity with things that you're not familiar with.

    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: Stored Procedure execution

    No, it can't. You'd do that with a client timeout, though the timeout affects the entire batch sent to the server, not subprocedures.

    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?

    Aaah...

    I'm hunting for a thread from July this year (before 18th July) on an apparent missing exclusive lock and strange lock escalation behaviour. I posted extensively to it, I know...

    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: Transaction log-Error 9002

    jacksonandrew321 (12/17/2015)


    Try to run the below Statement:

    DBCC SHRINKFILE(yourdbname_log, 1)

    BACKUP LOG yourdbname WITH TRUNCATE_ONLY

    DBCC SHRINKFILE(yourdbname_log, 1)

    GO

    Beside being appallingly bad advice (shrinking a log to 0 just forces SQL to spend a...

    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: Snapshot Replication Between 2008 R2 and 2014 SSMS

    I don't know merge replication, you should have said in the initial post it was for merge replication, not snapshot replication.

    I suspect the error means exactly what it says.

    the version...

    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: Is the sa account out of fashion?

    Yes, it's bad practice. SA is well known, and with the brute-forcing capabilities these days, 15 characters is not a strong password. It's known to be an admin account, it...

    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 - 3,976 through 3,990 (of 49,552 total)