Forum Replies Created

Viewing 15 posts - 2,131 through 2,145 (of 5,502 total)

  • RE: Loading XML Data into SQL Server (SQL Spackle)

    Ok, then we'd need to add the namespace declaration (result as above).

    Regarding your comment about the person sending you the file, here's what I'd say:

    Whoever sent you that file 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: Loading XML Data into SQL Server (SQL Spackle)

    Here's a short example to query data like you've posted (please note that I added a few end tags to change it into a valid xml structure as per SQL...



    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: row to column

    dpalani (1/11/2011)


    Thanks

    in the example i have said three columns, But i have more than 20 rows to be tranfered to column, And the data is huge. it will hit...



    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: Rows to Columns

    It looks like a job for the CrossTab method.

    Please see the related link in my signature.



    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: Please help with SQL code

    pwalter83 (1/11/2011)


    Hi Lutz,

    I really have no answer to your questions and am stuck with no option but to resign from my current position here.

    I actually made a bad choice when...



    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: row to column

    Another method would be a CrossTab query.

    For details please see the related link in my signature.



    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: Please help with SQL code

    pwalter83 (1/11/2011)


    Hello LutzM and Jeff,

    Thanks a lot for your replies. One thing I forgot to mention is that this project is part of an SSIS package. If you are...



    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: Please help with SQL code

    I still think it's better to use th additional column (as suggested before), maybe in combination with the exception table I mentioned.

    But the main issue still remains: how tro identify...



    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: Loading XML Data into SQL Server (SQL Spackle)

    The sample data you provided aren't XML data. Those are HTML data.

    As per http://www.w3schools.com/Xml/xml_whatis.asp

    XML is not a replacement for HTML.

    XML and HTML were designed with different goals:

    ...



    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: Export query with possible REPLACE clause...

    Change your heavy WHERE clause to

    INNER JOIN Categories_Products_Link

    ON p.ProductID = Categories_Products_Link.ProductID

    WHERE

    Categories_Products_Link.CategoryID IN (21,219,...)

    I'd also recommend to consider using an additional table to hold those numerous numbers if those...



    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: Rewriting the query without using 'Insert' <Query Optimization>

    Here's a test scenario showing that your code should work.

    Beside the table name, what's different on your end?

    DECLARE @tbl TABLE

    (

    ID INT,R_DATE DATETIME, SHRNCRS_NCST_CODE CHAR(2)

    )

    INSERT INTO @tbl

    SELECT...



    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: Please help with SQL code

    Paul,

    I'm not sure if I completely understood the logic behind your CASE statements. But to me it looks like you could add a (persisted) computed column to your DHL_TRADE_ASSIGNMENT table...



    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: Rewriting the query without using 'Insert' <Query Optimization>

    Strange. Should work. Is this the full query you posted?



    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: Rewriting the query without using 'Insert' <Query Optimization>

    Wouldn't the following return the same result?

    ;WITH cte AS

    (

    SELECT

    ID,

    R_DATE,

    CATEGORY,

    ROW_NUMBER() OVER (PARTITION BY SHRNCRS_NCST_CODEORDER BY R_DATE DESC) Rno

    FROM STABLE

    WHERE SHRNCRS_NCST_CODE IN('CC', 'MB')

    )

    SELECT *

    FROM cte

    WHERE Rno=1



    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: Rewriting the query without using 'Insert' <Query Optimization>

    You could either use a subquery with MAX() and GROUP BY or change the PARTITION BY part in your ROW_NUMBER subquery and use it directly against your source table.

    As a...



    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,131 through 2,145 (of 5,502 total)