Forum Replies Created

Viewing 15 posts - 16,051 through 16,065 (of 49,552 total)

  • RE: Struggling to create a VIEW in TSQL using code that works fine as a query :o(

    Please read the article Jeff referred to.

    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: truncate table

    TRUNCATE TABLE RoleMaster

    or, if it has foreign keys

    DELETE FROM RoleMaster

    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: Disk Usage by Top Tables

    Far easier way, just query sys.dm_db_partition_stats.

    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: Struggling to create a VIEW in TSQL using code that works fine as a query :o(

    A view is a single select statement, nothing more. No variables, no parameters, no other statements.

    You want either a stored procedure (recommended) or a multi-statement table-valued user-defined function (not recommended...

    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: slow dm_db_index_physical_stats query

    Steve Malley (10/17/2012)


    Since I am only accessing the system catalog and a DMV, I would expect that performance should be consistent and fast.

    Except that DMV is not a view...

    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: Logic problem in "SET [Quantity_Remaining] = [Quantity_Remaining] - 1"

    Start by reading the Books Online pages on triggers, then try and rewrite your trigger without the IF statement (which won't even parse) and using the INSERTED table (which will...

    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: Upgraded SQL Server 2005 to SQL Server 2008, but it still reports 2005

    If I had to guess, I'd say SQL 2008 was installed as a new installation (not an upgrade) and the database engine was not installed. So 2008 client tools and...

    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: .bak file quadrubles in size with restore

    When restoring SQL recreates the DB exactly as it was at time of backup, including file sizes. So you will need space for the full size of the original DB.

    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: "Incorrect syntax near 'AS'. Expecting ID, '(', or PRIMARY"

    You haven't finished the last join in the from clause.

    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: "Incorrect syntax near 'AS'. Expecting ID, '(', or PRIMARY"

    You need an alias for the subquery in the from, and you need to finish the missing portion of the join clause.

    p.s. Please post new questions in new threads 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: I had a Question Asked of Me today, that I Never Thought About Before

    Think of SQL 2008 R2 as if it was named SQL Server 2010 and things are generally a lot clearer

    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: Quic answer plzzzz

    You can't avoid locks, by indexing or otherwise. SQL will always take necessary locks, whether there's one connection using the table or 20.

    Chapter 6: http://www.simple-talk.com/books/sql-books/troubleshooting-sql-server-a-guide-for-the-accidental-dba/

    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: I had a Question Asked of Me today, that I Never Thought About Before

    Sure they can. It's just like putting 2005 and 2008, or 2008 R2 and 2012. They're all different versions of SQL.

    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: just backup and restore will fix any performance problem?

    No.

    What that will do is clear the plan cache which might temporarily alleviate any problems caused by poor plans, but it certainly won't fix those problems, just hide them for...

    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: Shrinking Transaction Log File "the right way"

    JeremyE (10/16/2012)


    I might be missing something so I'm hoping someone can clear it up.

    I have used TRUNCATEONLY on log files in SQL 2008R2 before to remove VLF fragmentation. I double...

    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 - 16,051 through 16,065 (of 49,552 total)