Viewing 15 posts - 3,661 through 3,675 (of 4,085 total)
Rob Titerle (8/4/2011)
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 4, 2011 at 1:02 pm
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
August 3, 2011 at 11:42 am
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
July 27, 2011 at 10:26 am
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
July 27, 2011 at 9:19 am
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
July 27, 2011 at 7:16 am
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
July 27, 2011 at 6:49 am
mfink (7/26/2011)
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
July 26, 2011 at 1:18 pm
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
July 26, 2011 at 10:03 am
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
July 26, 2011 at 9:50 am
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
July 25, 2011 at 2:46 pm
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
July 25, 2011 at 2:11 pm
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
July 25, 2011 at 1:36 pm
mfink (7/25/2011)
Msg 9438, Level 16, State 1, Line 2XML 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
July 25, 2011 at 12:25 pm
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
July 25, 2011 at 11:56 am
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
July 25, 2011 at 9:19 am
Viewing 15 posts - 3,661 through 3,675 (of 4,085 total)