Forum Replies Created

Viewing 15 posts - 16 through 30 (of 119 total)

  • RE: Running totals for previous X days

    Thank you both for your help, the query does make sense, thank you.

    If I run this for a slightly different sample data set, I get:

    DECLARE @T TABLE (Id INT, Category...

  • RE: Running totals for previous X days

    Thank you for your response. Yes, as the title suggests I'm trying to calculate the running totals.

    So for the first row:

    15 is the Total count

    11 is the Activated count

  • RE: Filling gaps in date ranges

    Thanks again, appreciate the help. If I added an additional attribute (ProductId) in my sample data would it be possible to include this in the result set so that it...

  • RE: Filling gaps in date ranges

    Jeff Moden (12/10/2014)


    clayman (12/10/2014)


    Hello,

    See sample data below. I want hourly breakdown for the last X years, the month and day will be the same for each year. Thank you

    SELECT...

  • RE: Last 30 days aggregate query

    Thanks, figured it out. The second solution seems to run ~6-7 times faster.

  • RE: Last 30 days aggregate query

    Thank you. Can you please help changing the query so that it also works with a date range ( from date, to date)? What I'd like to do is I'd...

  • RE: Last 30 days aggregate query

    Thank you. Your query also returns data for October, I Only want to return data for the last 30 days so the oldest data I want to see should be...

  • RE: XQuery insert new node

    Thank you.

    Is there a way to replace A2 with something so that it is not hard-coded?

    SET @TXML.modify('insert sql:variable("@NXML") after (/Attribute/A2)[1]');

    No guarantees that A2 node will exist as they are optional....

  • RE: XQuery insert new node

    This is not the first time you are trying to help me out. Thank you very much.

    I should have mentioned that my XML is validated against a schema that looks...

  • RE: XQuery delete

    SET @XML.modify('replace value of (Attribute/*[local-name()=sql:variable("@n")]/text())[1] with sql:variable("@v")')

    Seems to work ok. Thanks.

  • RE: XQuery delete

    Thank You!

    Could you also tell what the query would be if I wanted to update the value of <A3> from a sql variable?

    DECLARE @XML XML = '<Attribute>

    <A1>6529</A1>

    ...

  • RE: Store attributes/values in XML column - table design

    Thanks for your response.

    The number of attributes/values will be different for each order item, some may have only 2-3, others may have a hundred. Say I can have at most...

  • RE: Query logic help please

    Seong-Bae Hwang (10/18/2014)


    Hi

    If t2 has large volume of data, there would be performance issue on your approach. My approach is below.

    USE tempdb;

    GO

    DECLARE @t TABLE (Id INT);

    INSERT INTO @t

    VALUES(108)

    , (102)

    , (103)

    ,...

  • RE: Query logic help please

    The reason why I split the string is that I want to order the Ids, eg.

    DECLARE @INPUT_STR VARCHAR(50) = '101,102,103,108';

    will be the same as

    DECLARE @INPUT_STR VARCHAR(50) = '103,102,101,108';

  • RE: Query logic help please

    Excellent, thank you.

Viewing 15 posts - 16 through 30 (of 119 total)