Viewing 15 posts - 3,661 through 3,675 (of 4,087 total)
If you use the grouping() functions, you can do this without the temp table.
SELECT
CASE WHEN Grouping(ID2) = 1 THEN ID END AS ID
, CASE WHEN Grouping(Val) =...
August 11, 2011 at 2:33 pm
It's probably easier to change your aggregate to a distinct count.
Count(DISTINCT Staff_Seq_Num)
You may also need to use another field if that doesn't give you the correct counts.
Drew
August 5, 2011 at 7:01 am
Rob Titerle (8/4/2011)
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...
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...
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....
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...
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...
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')...
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...
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...
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
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...
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...
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
July 25, 2011 at 12:25 pm
Viewing 15 posts - 3,661 through 3,675 (of 4,087 total)