Forum Replies Created

Viewing 15 posts - 49,366 through 49,380 (of 49,552 total)

  • RE: How to add column in specific position

    Adding a column using alter table will always put the column at the end.

    Enterprise manager completely recreates the table when you modify the structure, that's why it can add 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: When does the day end

    Hence, since SQL cannot store dates with a finer granularity than 3ms, the day ends at 23:59:59.997

    Other times which can be stored correctly include 23:59:59.993 and 23:59:59.990.

    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: crosstab query

    I don't know what decode does, and I don't know exactly what you're trying to do, but have a look at the following and see if it helps.

    SELECT job,

     sum(CASE...

    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: Optimising XML

    Thanks, that's good to know. This is the first time I'm working with xml in SQL. Haven't touched xml since I was doing webdev some years back.

    Agreed, name 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: Optimising XML

    I posted an example:

    <FilterString><Sender /><OurReference /><Reference>PT21   </Reference><Direction /><Type /><Host /></FilterString>

    Another example:

    <FilterString><Status /><Sender /><Reference /><AccountNo /><DateFrom>2005-09-01</DateFrom><DateTo>2005-09-28</DateTo></FilterString>

    It's the way the front end passes an array of parameters to SQL, so the only...

    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: Optimising XML

    Can't drop the xml, short of rewriting the entire front end app (which isn't an option) and large portions of the back-end code

    Basically (and very simplified), the front-end app calls...

    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 Update with Select

    Server: Msg 157, Level 15, State 1, Line 2

    An aggregate may not appear in the set list of an UPDATE statement.

    I thought of that first too, but a quick test...

    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: Granting Object Permissions on Tables

    only 15? I've got 978

    Add the roles db_datareader and db_datawriter to the login faelogin. That will automatically grant them rights to read...

    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 Update with Select

    Update POSumTable

    set ProductTotal = SumOfAmount,

         DiscountTotal = SumOfDiscount,

         TaxTotal = SumOfTax

    FROM (SELECT POno, sum(b.Productamt) AS SumOfAmount, sum(b.DiscountAmt) AS SumOfDiscount, sum(b.TaxAmount) AS SumOfTax

       FROM ItemTable

       GROUP BY PONo

       ) SumOfProducts

    WHERE SumOfProducts.POno =...

    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: Performing a count and looping through records

    If you absolutely must use a cursor (which is completely unnecesary in this case, and in most cases where people use them) then al least dclare it with sensible options.

    DECLARE...

    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: Performing a count and looping through records

    By percentage, do you mean the percentage of records that have 1, 2 or 3 in them? If so, this should work. If not, please post example data and required...

    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: Couldn''''t be a more Newbie question.

    Easiest is to do it in two steps

    UPDATE Table2 SET Description='LightBrown', code='lb' WHERE Description IN ('tan','beige')

    Then to remove duplicates

    DELETE FROM Table2 WHERE ID NOT IN

       (SELECT MIN(ID) FROM Table2

        ...

    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: Trailing Spaces being automatically trimmed?

    A few points...

    LEN(...) will always do a rtrim before it calculates the length. It's how the function works. If you retrieve the data you will see that the space is...

    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: Efficient trigger type

    AFTER and FOR are synonyms of each other. They create the same trigger. The only types of triggers available in SQL 2000 are AFTER and INSTEAD OF

    You can use the 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: Selecting only 2 latest records

    True. If you only want movies with comments after a certain date (and by my reading that wasn't what was required. I read that he wants all movies with 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

Viewing 15 posts - 49,366 through 49,380 (of 49,552 total)