Forum Replies Created

Viewing 15 posts - 2,986 through 3,000 (of 5,502 total)

  • RE: Pivot for weeks

    See the CrossTab link in my signature and change your query accordingly.

    Then read the DynamicCrossTab article (also refernced in my signature) to make it dynamic.

    Give it a try and see...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Pivot for weeks

    That's one of the reasons I prefer using the "old-fashioned" cross tab method over PIVOT.

    One of the other reasons is to make it dynamic more easily.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Pivot for weeks

    Change COUNT(Product) to COUNT(Week) .



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Single DELETE statement show high reads

    I'm just guessing that it is caused by the IN clause.

    Why don't you use DELETE FROM <tablename> WHERE Id =10 instead?

    If there is more than one value, use a subquery...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Query Execution Performance

    Based on the very limited information provided so far: reduce the number of rows in the table or in your select statement (the former by archiving data and the latter...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: replacing long running cursor

    I would use the "quirky update" method, assuming you're using SS2K and not SS2K5 or higher (in this case ROW_NUMBER() would be my preferred method).

    The quirky update method is described...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Changing an error message in the sys.messages system table

    There are several options I can think of:

    1) Analyze the index job if it can be optimized (e.g. only roerganize/rebuild indexes that need to be touched basd on fragmentation level)

    2)...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Weekly Data Pivot

    That's weird...

    Usually the usage of a format file takes care of conversion errors. If not, a staging table could be used to load the data. However, the final table should...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Weekly Data Pivot

    You might want to be a little more specific what you're really looking for...

    If you don't want to provide a start and end date, what will be the logic to...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Changing an error message in the sys.messages system table

    If you're "unhappy" with the system messages, create your own message and deal with the system generated messages by using a TRY/CATCH block.

    I'd be curious to know the business case...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Split characters in a column and insert in new rows

    Aspg (8/16/2010)


    Nobody around !

    Well, that's not really true...

    I, personally, decided not to reply since you're asking for a fix to your loop solution knowing there are alternatives available.

    So, instead of...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Weekly Data Pivot

    Hi,

    here's the solution using the view instead of the Tally solution (I only changed @SQL2):

    SELECT @SQL2 = COALESCE(@SQL2,'')

    + ' SUM(CASE WHEN WeekEndDate = ' + QUOTENAME(d.WeekEndDate,'''')

    + ' THEN TotalPageviews ELSE...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Find largest between 3 columns for each record

    I would use UNPIVOT (EDIT: or UNION ALL if the system is before SS2K5) to normalize the data and a MAX() aggregation grouped by ClientID.

    For a coded version I'd like...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Weekly Data Pivot

    Please post table def and some sample data in a ready to use format so I have something to test against. (see the first link in my signature for details...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Weekly Data Pivot

    You need to change your subquery to use View_DSA instead of the tally table to use only the weeks that show up in the table. You probably need to...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

Viewing 15 posts - 2,986 through 3,000 (of 5,502 total)