Forum Replies Created

Viewing 15 posts - 3,571 through 3,585 (of 5,502 total)

  • RE: Adding row and column totals to a dynamic pivot table

    Since you're talking about a dynamic PIVOT I assume you're familiar with dynamic T-SQL syntax.

    Therefore, I recommend to have a look at the DynamicCrossTab link referenced in my signature. It...

  • RE: Need Ideas for a large lookup table solution

    PaulB-TheOneAndOnly (5/7/2010)


    Cory Blythe (5/7/2010)


    The table would be simple Zip1, Zip2, Distance.

    Some of the more common uses would be find all Values of Zip2 within 10 miles of Zip1 etc.

    Once table...

  • RE: Need Ideas for a large lookup table solution

    Oh, I need to add one more question: how accurate do you need to calculate the distance? Or, in other words: What is the largest distance you're dealing with?

  • RE: Need Ideas for a large lookup table solution

    I strongly vote against that proposal!

    Alternatively I would recommend to tune the on-the-fly solution.

    Just because the current solution has performance issues does not imply in any way that there is...

  • RE: How do you count number records added in recent period

    How does the table structure looks like (including sample data)?

    What do you consider as a "sent message"?

    Example: I send a mail to 10 people using a single mail and miltiple...

  • RE: Calculating cumulative product from previous row (without using cursors)

    CirquedeSQLeil (5/6/2010)


    vijay.s (5/6/2010)


    No ReturnPercent its only name it have full numeric value like amount.

    But for client 1 your sample data is summing that column with the cumulative column.

    No, it's not...

  • RE: Calculating cumulative product from previous row (without using cursors)

    Ok, here's a coded version based on the link Jason provided:

    DECLARE

    @ClientCode INT,

    @cumReturn NUMERIC(18,4)

    SET @ClientCode=0

    SET @cumReturn=0

    UPDATE #Scores

    SET

    @cumReturn=

    CumulativeReturn=

    CASE

    WHEN @ClientCode=ClientCode

    THEN @cumReturn * (100 + ReturnPercent)/100

    ELSE CumulativeReturn

    END,

    @ClientCode = clientcode

    FROM...

  • RE: Need help with a query

    WayneS (5/5/2010)


    lmu92 (5/5/2010)


    Might be agood idea to turn it into an article...

    Yes, it would. Which reminds me... are you writing one based upon that post last year where you found...

  • RE: Multiply DB Query not working.

    Glad I could help 🙂

  • RE: Need help with a query

    WayneS (5/5/2010)


    lmu92 (5/5/2010)


    I would rather recommend you to modify the related sp's not to use DATEPART() anymore. Instead of using DATEPART(dw,...) you could use DATEDIFF(dd,'19000101',YourDate)%7. This will ALWAYS return 0...

  • RE: Need help with a query

    keent (5/5/2010)


    Excellent point. I may have to add a line to set that on all of my stored procedures just for safety. We are a small shop and I am...

  • RE: Dynamic Query/sproc

    alex abenitez (5/5/2010)


    The Dynamic part is for the creation of the fields. It starts out with the 1 column with the string of names (comma delimited).

    Do you know how...

  • RE: Dynamically Import Multiple XML files (SQL2K5)

    One of the most interesting methods to connect to a list of files in a folder with (almost) pure SQL has been posted by Lowell here .

    Once you have...

  • RE: Multiply DB Query not working.

    kbnyny (5/5/2010)


    why is this statement not working:

    select t1.ACTNUMBR_1, t1.ACTNUMBR_4, t1.ACTINDX, t1.CREATDDT

    from C1.dbo.AN00100 t1 union all

    select t2.ACTNUMBR_1, t2.ACTNUMBR_4, t2.ACTINDX, t2.CREATDDT

    from C2.dbo.AN00100 t2 union all

    select t3.ACTNUMBR_1, t3.ACTNUMBR_4, t3.ACTINDX, t3.CREATDDT

    from C3.dbo.AN00100 t3

    WHERE...

  • RE: Need help with a query

    When you do your testing, try the following:

    before running your query, add

    SET DATEFIRST 1 -- set the first day of a week = Monday

    The result of your query might be...

Viewing 15 posts - 3,571 through 3,585 (of 5,502 total)