Tuesday, March 20, 2012
Save the return value into a variable
How can I save the returned XML Expression into a variable? I tried to this
a described on the next line, but with no luck...
I use SQL Server 2000 SP 4
DECLARE @.doc nvarchar(4000)
SET @.doc = (SELECT * FROM sysdba.Account WHERE AccountID = 'ALFKI' FOR XML
auto)
Thank's
MichelHello Michel,
Can't be done in SQL Server 2000 since the XML Serialization is always done
post query there.
Thanks,
Kent Tegels
http://staff.develop.com/ktegels/|||If you have SQL Server 2005, the below query is valid. And you'lll have more
features in FOR XML.
"Michel" <michel_mueller@.bluewin.ch> wrote in message
news:ujy1pp69GHA.4708@.TK2MSFTNGP05.phx.gbl...
> Hi
> How can I save the returned XML Expression into a variable? I tried to
> this a described on the next line, but with no luck...
> I use SQL Server 2000 SP 4
> DECLARE @.doc nvarchar(4000)
> SET @.doc = (SELECT * FROM sysdba.Account WHERE AccountID = 'ALFKI' FOR XML
> auto)
> Thank's
> Michel
>
Save the return value into a variable
How can I save the returned XML Expression into a variable? I tried to this
a described on the next line, but with no luck...
I use SQL Server 2000 SP 4
DECLARE @.doc nvarchar(4000)
SET @.doc = (SELECT * FROM sysdba.Account WHERE AccountID = 'ALFKI' FOR XML
auto)
Thank's
Michel
Hello Michel,
Can't be done in SQL Server 2000 since the XML Serialization is always done
post query there.
Thanks,
Kent Tegels
http://staff.develop.com/ktegels/
Wednesday, March 7, 2012
Sanity Check: Measure Expression nearly always better than Calculated Measure?
Hey All --
From what I've read, Measure Expressions are generally superior to Calculated Measures because we can actually aggregate them. Most of the examples of Measure Expressions I've seen are something along the lines of [Measures].[Sales] / [Measures].[Sales Cost]...Both values are part of various measure groups.
I assume that even if I 'hard code" a value as in the following example my performance is STILL going to be much better in a measure expression (assuming we take advantage of aggs) than doing the same thing in a calculated measure:
[Measures].[Sales SubTotal] * 1.08 //Sales Tax)
So, I guess the question I'm asking is: Must a "valid" measure expression include ONLY measures and operators, or can it include any hard coded constant value I want to stick in, as well...And if the latter situation is "OK", we still get all of our perf benefits, etc.
Thanks!
The best thing to do would be to give it a shot with both approaches and see which works best for you. Look at both query response time and processing time impacts.
The SSAS 2005 Performance Guide suggests this is an optimal solution when working with data from multiple measure groups ... which is the case you identify above. Again, try it and see.
The easiest way to compare the two would be to go ahead and create the Measure Expression, process your cube, execute an MDX query to return data from the measure with the defined measure expression. Then, recreate the calculation in a WITH MEMBER clause of another MDX statement and compare its execution time to the original.
Good Luck,
Bryan