Forum Replies Created

Viewing 15 posts - 3,766 through 3,780 (of 4,085 total)

  • RE: Shredding XML - Need to Include OfferId

    pamozer (3/3/2011)


    I'm assuming the OP is me but what does it stand for? And I hadn't checked the actual data yet only the counts.

    OP is Original Poster.

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Shredding XML - Need to Include OfferId

    opc.three (3/3/2011)


    drew.allen (3/3/2011)


    opc.three (3/3/2011)


    Try this:

    SELECT b.value('(offerId)[1]', 'Int') AS [offer_id],

    fr.value('(internetPrice)[1]', 'decimal') AS [internet_price],

    fr.value('(newStandPrice)[1]', 'decimal')...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Shredding XML - Need to Include OfferId

    opc.three (3/3/2011)


    Try this:

    SELECT b.value('(offerId)[1]', 'Int') AS [offer_id],

    fr.value('(internetPrice)[1]', 'decimal') AS [internet_price],

    fr.value('(newStandPrice)[1]', 'decimal') AS [news_stand_price],

    ...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Shredding XML - Need to Include OfferId

    You're shredding the same document twice when you really don't need to, because you started from the highest relevant point in the document hierarchy and worked down, when you really...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: how grab text before a "-" character in a join

    Jeff Moden (3/2/2011)


    drew.allen (3/2/2011)


    Another option is to use the LIKE operator. I don't know which will perform better.

    SELECT *

    FROM TableA

    INNER JOIN TableB

    ON TableA.ID LIKE Cast(TableB.ID as varchar(11)) + '%'

    This...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: how grab text before a "-" character in a join

    Another option is to use the LIKE operator. I don't know which will perform better.

    SELECT *

    FROM TableA

    INNER JOIN TableB

    ON TableA.ID LIKE Cast(TableB.ID as varchar(11)) + '%'

    This assumes that the...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Concatenating numeric fields

    Do you really want to return fiscal year plus calendar month rather than fiscal year plus fiscal period?

    I also dislike using a CASE statement to return the fiscal year, because...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: ERROR cursor:The cursor does not include the table being modified or the table is not updatable through the cursor.

    yoho23_2000 (2/22/2011)


    Is there anything obvious you can see

    Yes, you're using a CURSOR when you should be using a set-based approach. I can't tell you the exact set-based approach to...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Detach trigger code

    What I've done in these cases is use a TRY/CATCH block leaving the CATCH block empty.

    BEGIN TRY

    EXEC msdb.dbo.sp_send_dbmail <your parameters here>

    END TRY

    BEGIN...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Conditional Where statement

    The problem with your original CASE statement is that you were trying to return a Boolean value and T-SQL won't let you return a Boolean value. You can restructure...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Nested Case Statement possible?

    You can also rewrite this using a single CASE statement, which is usually more succinct and therefore easier to follow.

    Select

    case when SO.CUSTOMER = R.CUSTOMER AND R.QUANTITY_REMAINING >= R.CUSTOMER_QTY_NOT_SHIPPED

    then...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Need the Price with the Latest Date

    Jeff Moden (2/1/2011)


    drew.allen (1/31/2011)


    Craig Farrell (1/31/2011)


    After having done some other tests, this method seems to be the quickest, especially if you have a solid index on Item/ChangePriceDate

    My tests indicate the...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Need the Price with the Latest Date

    Craig Farrell (1/31/2011)


    After having done some other tests, this method seems to be the quickest, especially if you have a solid index on Item/ChangePriceDate

    My tests indicate the opposite. I've...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Need the Price with the Latest Date

    What have you tried already and where are you running into problems? I'd recommend looking at Row_Number() or other ranking functions.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Pivot the result of the select statement

    krishusavalia (1/31/2011)


    Garadin,

    I appriciate your fast responce.

    But in my actual xml file i have name space so in the code i am declaring the name space.

    ;WITH XMLNAMESPACES(default 'http://schemas.xmlaaaa.org/aaaaenv/envelope/')

    so when i am...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 3,766 through 3,780 (of 4,085 total)