Forum Replies Created

Viewing 15 posts - 76 through 90 (of 97 total)

  • RE: In what circumstances are there no other option than to use cursors?

    Hi all,

    I will explain a case when I coded a cursor as a good solution to a problem.

    Some months ago I coded a Stored Procedure to purge a table based...

  • RE: Optimization strategy?!

    Eugene Elutin (9/29/2010)


    1. Your "Movements" table example looks very familiar to me (and I guess to many who worked with transactional data). From practical prospective I can say that such...

  • RE: Optimization strategy?!

    Hello Eugene,

    oops, I'm seeing I wrote "...you will always never read this table ordered by ID...", what a mistake, I tried to write "...you will almost never read this table...

  • RE: Optimization strategy?!

    Hello,

    as far as I know a clustered index is best for sequential reading. If you create a clustered index using Attrib_Z, any query like

    SELECT * FROM Widgets WHERE Attrib_Z =...

  • RE: Sql View - Performance Tuning

    Hello James,

    well, not all solutions work all times :crying:. That means that SQL Server solved the CROSS JOIN as a INNER JOIN, then changing the view source code has no...

  • RE: Dynamically change the occurrence of columns in a table

    Hello,

    your query can be rewritten using PIVOT as

    SELECT *

    FROM (

    SELECT ItemNo

    , cast(Year as varchar(4)) + ' ' + CONVERT(varchar(3), dateadd(m, mnth, -1), 107) as MnthName

    , OrderMade

    FROM Order_rep

    ) P

    PIVOT (

    SUM(OrderMade)

    FOR...

  • RE: Sql View - Performance Tuning

    Hello James and all,

    there is another way to try to improve performance in this query; you can create an index for AdvStats using the columns

    shift_number

    ...

  • RE: Sql View - Performance Tuning

    Hello all,

    I would suggest two changes to the original view, maybe these changes help.

    First: really there is no need for a CROSS JOIN, the query could be rewritten using INNER...

  • RE: Selecting the max date from view

    Hello esilva,

    as I read your latest reply you are contradictory, your first paragraph says one thing and your second paragraph states the opposite. As I understand it, you need:

    - First...

  • RE: Slow running proc...

    Hello,

    looking at your code there is something I don't understand, let's me explain:

    You define your first cursor, SessionCurs,

    DECLARE SessionCurs CURSOR FAST_FORWARD FOR

    Select StartDate,...

  • RE: Update one column of a table with data from another table

    hi 999baz,

    it depends, doing this update you will lock a big chunk of data.

    First of all you must test it, use your development DB and test with 10000 rows, 100000...

  • RE: Very slow query with only 2 joins

    Hi frharkonnen (maybe Feyd-Rautha?),

    this is how I understand your schema:

    Tag and Topic are master tables with a N:N relationship, TopicTag is the table that sustains this relationship. Rank is a...

  • RE: Needa Query to filter the matching records

    You said you must compare 5 fields. Maybe they are the joining key?, try it:

    SELECT A.* FROM A

    LEFT JOIN B

    ON A.Field1 = B.Field1

    ...

  • RE: Table growing too large

    Hello,

    what indexes your table has?. I suppose you access your data in two ways:

    - Asking for contacts in a given campaign.

    - Asking for campaigns for a given contact.

    To run these...

  • RE: ROW_NUMBER() OVER (ORDER BY ) is very slow with large dataset

    Why about changing your BETWEEN clause by a SELECT TOP?, try it:

    SELECT TOP 50 *, ROW_NUMBER() OVER (

    ORDER BY

    CASE WHEN @pSortFieldName = 'column1'

    ...

Viewing 15 posts - 76 through 90 (of 97 total)