Forum Replies Created

Viewing 15 posts - 3,661 through 3,675 (of 4,085 total)

  • RE: Finding and recording offset values using SQL

    Rob Titerle (8/4/2011)


    This is a fundamentally simple problem, but I don't see what is likely the obvious solution. Any help pointing out the obvious to me would be greatly...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: XML Query Attributes

    I assume that you actually want where the name attribute is "FirstAttributeName" since there is nothing named "FirstAttribute" in your sample.

    This should give you what you want.

    SELECT per.value('(Data/item[@name="FirstAttributeName"])[1]', 'varchar(50)') AS...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Adding a Decimal Value to a DateDiff Statement

    DateDiff will always produce an integer result. You need to move your addition outside of the DateDiff function.

    CASE Type WHEN 'HALF' THEN DATEDIFF (d, StartDate, EndDate) + 0.5

    You're thinking...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Dimension/Fact table design books

    Sqlraider (7/27/2011)


    Any chance you could translate those pieces into FACT & DIM or give me a starting point?

    In its most basic form, think of it as AGGREGATE FACT BY DIMENSION....

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: How to transpose reccords in SQl Server 2005

    In most cases where there is no obvious aggregation, you'll want to use Min() or Max(). If there is only one value corresponding to each pivot value, they'll give...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Adding a Decimal Value to a DateDiff Statement

    Jeff Moden (7/26/2011)


    DATEDIFF doesn't work the way most people think. It works on the borders of days (ie: midnight).

    I would amend this to say that it works on the...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Google Analytics XML file to SQL2005 table

    mfink (7/26/2011)


    A completed version of the problem and solution

    SELECT

    c.value('(//AnalyticsReport/Report/Title/ProfileName)[1]','varchar(100)') as WebPage,

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

    , c.value('(DrilldownId)[2]', 'varchar(25)') AS Region

    , c.value('(Cell/Content/Value)[1]', 'int') AS Counts

    FROM @x.nodes('/AnalyticsReport/Report/Table/Row')...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Delete data older than 30 days, char to datatime conversion.

    All of the valid formats require some kind of separator between the various components except for 112 which doesn't include the time components. Your conversion is failing, because your...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: 3 views similar data into 1 report

    Since we don't have information on your base tables or your views, it's hard to say what the best approach might be. If your views are simple selects on...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Google Analytics XML file to SQL2005 table

    If you're going to be working with XML, you need to learn XPath. There is a tutorial at W3Schools http://www.w3schools.com/xpath/. XPath is very easy.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Google Analytics XML file to SQL2005 table

    mfink (7/25/2011)


    AnalyticsReport('(ProfileName)[0]','varchar(100)') as WebPage1,

    c.profileName('(ProfileName)[0]','varchar(100)') as WebPage1,

    c.value('(ProfileName)[0]','varchar(100)') as WebPage2,

    none of these am I headed in the right direction?

    What's the current node?

    What's the relative path from the current node to ProfileName?

    You're using...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Google Analytics XML file to SQL2005 table

    mfink (7/25/2011)


    How would I add the profileName to that select?

    See if you can figure it out for yourself. You just need to determine the relative path from your current...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Google Analytics XML file to SQL2005 table

    mfink (7/25/2011)


    Msg 9438, Level 16, State 1, Line 2

    XML parsing: line 2, character 6, text/xmldecl not at the beginning of input

    You can't have any whitespace before the <?xml version="1.0" ?>.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Google Analytics XML file to SQL2005 table

    My previous post contains all the information specific to XML. The rest is standard SQL stuff. You declare an XML variable and set the value of the variable...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Google Analytics XML file to SQL2005 table

    I used an XML variable. If you use an XML column, you'll probably need to use CROSS APPLY in order to evaluate for each row.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 3,661 through 3,675 (of 4,085 total)