Forum Replies Created

Viewing 15 posts - 2,836 through 2,850 (of 49,552 total)

  • RE: Inserting Where values don't Exist

    In that case, instead of SELECT @name, @val WHERE, it would be

    SELECT s.name, s.val

    FROM SomeOtherDatabase.dbo.SomeOtherTable s

    WHERE NOT EXISTS (SELECT 1 FROM u_apppreferences WHERE name = s.name)

    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: Trace login + db names

    If it's server-side traces that you're using, then the easiest thing is to use Profiler to set up the trace, then go to File -> Export -> Script Trace Definition

    That...

    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 Procedures not accessible

    Sounds like you're using an old version of Management Studio with a new version of SQL. What do the following show:

    SELECT @@Version

    In Management Studio: Help -> About

    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 TempDb files

    dclemens (7/5/2016)


    I want 8 files because I have 8 CPUs.

    8 CPUs doesn't mean 8 files for TempDB.

    Using this query, I'm showing avg_write_stall_ms >280ms, which seems very high to me.

    Adding...

    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: Sql script not working properly

    tindog (7/6/2016)


    In your WHERE clause you convert EmpID to VARCHAR(20), although both the table field and the variable are INT

    He's converting it to varchar in order to concatenate 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
  • RE: Sql script not working properly

    Because if you leave out the quotes, then you have something like this:

    AND EmpCode = 256781

    Where EmpCode is a varchar column and 256781 is a literal with a numeric type....

    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: Trace login + db names

    2008, so you're using server-side traces?

    The Security Audit: Audit Login has both database id and database name as event columns. Just check the boxes when you create the trace, they're...

    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: Trace login + db names

    Add the DB name from the (Global Fields) Actions tab, it won't be default part of the event's columns

    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?

    Steve Jones - SSC Editor (7/5/2016)


    Also, as we've evolved, so have spammers. They change tactics, so there is a race here, and sometimes it's easier to work with what we...

    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: Single database attached to two instance - how to take backups from each instance

    SSC Venu (7/4/2016)


    Here i have attached "AdventureWorks" sample databases to "default instance (11.0.6020) & named instance (11.0.2100). same databases in two instances...

    No you haven't.

    You have two copies of 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: Single database attached to two instance - how to take backups from each instance

    Steve Jones - SSC Editor (7/5/2016)


    So if you have a 2008 RTM instance and a 2008 SP3 instance, you can restore RTM backups to the SP3 instance, but not vice...

    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: Find top 10 expensive queries in the past 10 minutes

    Create an extended event session, run it for the 10 minutes that you want to analyse, query the resulting file.

    You can use the DMVs, specifically sys.dm_exec_query_stats, but they won't necessarily...

    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: Case statement confusion

    To explain why you're getting syntax errors, the output of a case statement must be an expression (constant, parameter, column, variable or function), not a clause or a predicate 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: Inserting Where values don't Exist

    INSERT into u_apppreferences(name, Val)

    SELECT @name, @VAL

    WHERE NOT EXISTS (SELECT 1 FROM u_apppreferences WHERE name = @name)

    as your current one is prone to concurrency problems (will cause duplicates under load)

    http://source.entelect.co.za/why-is-this-upsert-code-broken

    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: Single database attached to two instance - how to take backups from each instance

    You can't attach a single database to two instances. A database can only be attached to a single instance.

    I suspect you only have one instance, not two, hence when taking...

    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 - 2,836 through 2,850 (of 49,552 total)