Forum Replies Created

Viewing 15 posts - 49,201 through 49,215 (of 49,552 total)

  • RE: Can a long running select query cause locking and impact an update transaction?

    I would suggest NOLOCK as a last resort. Look at optimising your select as much as possible to get it running faster, also look at optimising the update. Firstly you...

    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: Can a long running select query cause locking and impact an update transaction?

    Yes it can. As that piece from books online stated, a select takes shared locks for the duration of it's execution. A shared lock means that while other reads can...

    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-431

    Thanks Todd. I noticed the E-Learning. How long does it take? I was considering taking it during lunch breaks next week.

    I've got a lot of experience with 2000, and have...

    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: Cursor or not

    There's not that much difference between a cursor that processes a set of records one by one and a while loop that processes a set of records one by one....

    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 it possible to trap or log FATAL ERROR from a stored proc?

    Can you give an example of @sql_string?

    There is an error avoidence technique that you could use:

    IF EXISTS (SELECT 1 FROM sysobjects WHERE name='TableToBeDropped')

     DROP TABLE TableToBeDropped

    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: Help with Left Join in query and ordering

    Yes, but it will require a subquery to do the calculation

    SELECT PRODUCTS.PRODUCT_ID, PRODUCTS.P_NAME, VOTES.V_SCORE

    FROM [PRODUCTS]

    LEFT JOIN [VOTES]

      ON VOTES.PRODUCT_ID = PRODUCTS.PRODUCT_ID AND

           VOTES.USER_ID = 3

    LEFT OUTER JOIN (SELECT Product_ID,...

    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: Correlate dbname and his dbfile (data+log)

    I'm not a fan of dynamic SQL, but this is a place where it will help.

    DECLARE @DBName varchar(20)

    SET @DBName = 'msdb'

    DECLARE @sSQL VARCHAR(500)

    SET @sSQL = 'SELECT name, filename FROM '...

    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: Writing queries best practice

    I mostly agree with Marco. Here's a suggested rewrite

    SELECT Table01.field01, Table01.field02, Table01.field03, Table01.field04, Table01.field05

     FROM Table01 LEFT OUTER JOIN Table02 ON Table01.field03 = Table02.field03

     LEFT OUTER JOIN Table03 ON Table01.field03 = Table03.field03

     WHERE...

    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: Changing collation.

    You can change TempDB's collation by changing the colation of then entire server. That will involve rebuilding the master database with the new collation. Look up Rebuildm in books online.

    If you are...

    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: Updates which don''''t participate in a transaction.

    How about building up an insert/update statement as a string then executing it after the rollback. Something like this

    BEGIN TRANSACTION

    Insert into VeryImportantTable (...) values (...)

    IF @@Error!=0

    BEGIN

    DECLARE @sSQL VARCHAR(1000)

    SET @sSQL =...

    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 it possible to trap or log FATAL ERROR from a stored proc?

    Yes you can. You can't trap the ones above 20, but those are written into the error log. 11 through 19 are standard errors, less than 11 are warnings or...

    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 it possible to trap or log FATAL ERROR from a stored proc?

    Correction. TRY...CATCH only catch errors with severity>10 (anything less than that is a warning or information message and not an error) and will only catch errors that don't close 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: Using MIN/MAX in update

    Ah, then you should be able to get what you want in Table3 with a single insert, no need for a seperate update after.

    INSERT INTO Table3(custID, DOB_Min, DOB_Max)

    SELECT Table1.CustID, MIN(Table2.DOB),...

    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: Using MIN/MAX in update

    You can do it in one step(if you had custID in table 2 that is)

    Insert into Table3 (CustID, DOB_Min, DOB_Max)

    SELECT CustID, MIN(C_DOB), MAX(C_DOB) FROM Table2 GROUP BY CustID

    How do table1...

    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: READTEXT into variable

    <sarcasm>Well excuse me for trying to help</sarcasm>

    Just offerng an additional possibility that doesn't require adding an additional parameter to the procedure to deal with the output of substring.

    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 - 49,201 through 49,215 (of 49,552 total)