Forum Replies Created

Viewing 15 posts - 3,181 through 3,195 (of 5,502 total)

  • RE: return calculated null as 0

    A few more things to notice:

    I'm not sure how the functions to_char and to_date are written, but I guess both can be replaced by the built-in function CONVERT(). The to_date...



    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: return calculated null as 0

    Based on the limited information we have so far I recommend using a calendar table as the left part of an outer join.



    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: Parsing XML Data

    Azzu (7/8/2010)


    Hi

    I have the following XML string

    '<SampleXML>

    <Colors>

    <Color1>White</Color1>

    <Color2>Blue</Color2>

    <Color3>Black</Color3>

    <Color4 Special="Light">Green</Color4>

    <Color5>Red</Color5>

    </Colors>

    <Fruits>

    <Fruits1>Apple</Fruits1>

    <Fruits2>Pineapple</Fruits2>

    <Fruits3>Grapes</Fruits3>

    <Fruits4>Melon</Fruits4>

    </Fruits>

    </SampleXML>'

    my question is how to knoiw whether the string is a valid xml or not. Preferably i'd like to do it...



    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: Newbie sp_xml_preparedocument

    (o_0) (7/7/2010)


    Hi all,

    I'm new to sp_xml_preparedocument

    I'm running code below and is returning null values.

    declare @idocint,

    @xmlvarchar(200)

    set @xml = '

    <CD>

    <TITLE>Empire Burlesque</TITLE>

    <ARTIST>Bob Dylan</ARTIST>

    <COUNTRY>USA</COUNTRY>

    <COMPANY>Columbia</COMPANY>

    <PRICE>10.90</PRICE>

    <YEAR>1985</YEAR>

    </CD>'

    exec sp_xml_preparedocument @idoc output, @xml

    select*

    fromopenxml(@idoc, '/CD', 2)

    with(titlevarchar(25),

    artistvarchar(25),

    countryvarchar(25),

    companyvarchar(25),

    pricedecimal,

    yrchar(4))

    is there something...



    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: Write Query Dynamic Generated Column

    @Alban Lijo

    You might want to have a look at the articles I pointed at in my previous post.

    I guess the approach described in those articles will be "slightly faster" than...



    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: xquery for elements with specific attributes

    I'm not sure whether it's a good idea or not to ask a question using the "sliced salami approach"...

    Here's the related link with the other two questions regarding the very...



    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: CTE or Pivot Table ??

    The main reason your first approach failed (at least as far I can see):

    You have DATENAME(MONTH,LoginDate) in your GROUP BY clause.

    This made the SUM() aggregation obsolete leading to the results...



    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: Actually i was wondering like how to create three sub columns for a main column i.e like Age is the mail column and it has 3 sub columns

    Actually,

    there is already an ongoing discussion here.

    @vinod

    opening an identical thread just because you don't seem to like the replies you get is not really a professional way...

    As you might notice,...



    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: Get NEsted XML into variable

    There might be an easier way to do it but here's a solution that first extract the value and assign "P" as an table alias and "id" as the column...



    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: Actually i was wondering like how to write a sql code for combining 3 different columns into a single column

    It seems like you didn't bother to read and follow the article I pointed you at or at least follow the recommendation I made in my previous post.

    It leaves the...



    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: Actually i was wondering like how to write a sql code for combining 3 different columns into a single column

    vinodvadla (7/6/2010)


    What exactly you want me to provide LUTZ.

    Thanks & Rgrds,

    Vinod

    Table def in the format of CREATE TABLE FcHistory.dbo.tdwClaims () for all tables use in the query.

    Fake but consistent sample...



    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: Get NEsted XML into variable

    How about

    SELECT @xml_child_element = @xml_complete.query('/U/N[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: Write Query Dynamic Generated Column

    Instead of using the PIVOT approach I'd recommend you read the CrossTab article referenced in my signature.

    The result of the CrossTab method is similar to the PIVOT approach with one...



    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: My XML procedure is so slo-o-o-o-w

    Why not simply using the "old-fashioned" method?

    SELECT

    xmlFileName,

    c.value('SSN[1]', 'varchar(30)') AS ssn,

    c.value('TaxableWages[1]' , 'varchar(30)') AS TaxableWages

    FROM XmlImportTest

    CROSS APPLY

    xml_data.nodes('ROOT/Employee') T(c)

    If this solution doesn't give you the desired result you might want to...



    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: Actually i was wondering like how to write a sql code for combining 3 different columns into a single column

    Please provide ready to use table def and sample data as described in the first link in my signature. It'll help us help you.



    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 - 3,181 through 3,195 (of 5,502 total)