Sunday, March 25, 2012
Analysis Service Connection Pooling
the Analysis Service Connection Pooling sample. Please help me in locating
the code sample.
Thanks in advance.
Manoj
http://msdn.microsoft.com/library/de...onnpooling.asp
Dave Wickert [MSFT]
dwickert@.online.microsoft.com
Program Manager
BI SystemsTeam
SQL BI Product Unit (Analysis Services)
This posting is provided "AS IS" with no warranties, and confers no rights.
"Manoj" <Manoj@.discussions.microsoft.com> wrote in message
news:AF17E419-ED8D-4E97-AA3D-76A06BCFD465@.microsoft.com...
> In SQL Server documentation it is mentioned that the SP3 Code sample
contains
> the Analysis Service Connection Pooling sample. Please help me in locating
> the code sample.
> Thanks in advance.
> Manoj
Tuesday, March 20, 2012
An unknown error occurred in the WMI provider. Error Code 8000000A
Hi,
I just installed SQL Server 2005 on Windows Vista.
I am getting an error "An unknown error occurred in the WMI
provider. Error Code 8000000A" when connecting to a web server. The
reporting services is running. Is there any other installation that is
missing. Please help.
Reporting Services is not supported on Windows Vista until SP2 of SQL Server 2005 is available. It is due out early next year. If you are an SP2 preview customer, you can try it before then. You can find out about this program at: http://www.microsoft.com/sql/ctp.mspx
|||Hi,
I have just received the same error message when opening then Reporting Services configuration tool. The server is running MS Windows Server 2003 Standard Edition with Service Pack 1 and SQL Server 2005 Standard Edition with Service Pack 1. I don't have local administrator rights, but I am an administrator for SQL Server and I am in the system administrator group for Reporting Services.
I have already made done some web research, but all I have found was related to Windows Vista only.
Thanx for any help and best regards,
Gerald|||I am having the same problem as described for Server 2003. Do we just need to try SP2?
An unknown error occurred in the WMI provider. Error Code 8000000A
Hi,
I just installed SQL Server 2005 on Windows Vista.
I am getting an error "An unknown error occurred in the WMI
provider. Error Code 8000000A" when connecting to a web server. The
reporting services is running. Is there any other installation that is
missing. Please help.
Reporting Services is not supported on Windows Vista until SP2 of SQL Server 2005 is available. It is due out early next year. If you are an SP2 preview customer, you can try it before then. You can find out about this program at: http://www.microsoft.com/sql/ctp.mspx
|||Hi,I have just received the same error message when opening then Reporting Services configuration tool. The server is running MS Windows Server 2003 Standard Edition with Service Pack 1 and SQL Server 2005 Standard Edition with Service Pack 1. I don't have local administrator rights, but I am an administrator for SQL Server and I am in the system administrator group for Reporting Services.
I have already made done some web research, but all I have found was related to Windows Vista only.
Thanx for any help and best regards,
Gerald
|||I am having the same problem as described for Server 2003. Do we just need to try SP2?
An 'OnClientConnected' on the Server side
-equivalent event on the server side that I can put some code to check who
has just connected or what application or workstation is connecting? I'm
looking for some way to check for 'valid' client applications.You can execute queries to view connection, session
information. In SQL Server 2000, query the sysprocesses
table in the master database. In SQL Server 2005, you can
query the dynamic management view sys.dm_exec_sessions. Both
have login times, host, program name and other info.
What you do from there depends on what you are trying to do
and what version of SQL Server may determine what options
are available to use.
-Sue
On Tue, 14 Feb 2006 13:25:28 -0800, "Trex"
<Trex@.community.nospam> wrote:
>Upon a client connecting to the server, is there an 'OnClientConnected'
>-equivalent event on the server side that I can put some code to check who
>has just connected or what application or workstation is connecting? I'm
>looking for some way to check for 'valid' client applications.|||Hello Trex,
You may want to consider to capture the audit logon/logoff event and store
them to a SQL table. Then you could use notification service to notfiy when
the insertion meets to requirment.
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.
--
>Thread-Topic: An 'OnClientConnected' on the Server side
>thread-index: AcYxrS0jasuUvcWgTpCZHnrqfgbL3A==
>X-WBNR-Posting-Host: 152.130.15.18
>From: "examnotes" <Trex@.community.nospam>
>Subject: An 'OnClientConnected' on the Server side
>Date: Tue, 14 Feb 2006 13:25:28 -0800
>Lines: 4
>Message-ID: <C4E19CC4-603C-4FD8-8044-96A28661C246@.microsoft.com>
>MIME-Version: 1.0
>Content-Type: text/plain;
> charset="Utf-8"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>Content-Class: urn:content-classes:message
>Importance: normal
>Priority: normal
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
>Newsgroups: microsoft.public.sqlserver.connect
>NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
>Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
>Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.sqlserver.connect:46902
>X-Tomcat-NG: microsoft.public.sqlserver.connect
>Upon a client connecting to the server, is there an 'OnClientConnected'
>-equivalent event on the server side that I can put some code to check who
>has just connected or what application or workstation is connecting? I'm
>looking for some way to check for 'valid' client applications.
>|||Sounds like a solution. I can monitor this and kill a process if I don't
like what I see. Thank you Sue!
"Sue Hoegemeier" wrote:
> You can execute queries to view connection, session
> information. In SQL Server 2000, query the sysprocesses
> table in the master database. In SQL Server 2005, you can
> query the dynamic management view sys.dm_exec_sessions. Both
> have login times, host, program name and other info.
> What you do from there depends on what you are trying to do
> and what version of SQL Server may determine what options
> are available to use.
> -Sue
> On Tue, 14 Feb 2006 13:25:28 -0800, "Trex"
> <Trex@.community.nospam> wrote:
>
>|||Thank you Peter...this may be another possiblity for me!
"Peter Yang [MSFT]" wrote:
> Hello Trex,
> You may want to consider to capture the audit logon/logoff event and store
> them to a SQL table. Then you could use notification service to notfiy whe
n
> the insertion meets to requirment.
> Best Regards,
> Peter Yang
> MCSE2000/2003, MCSA, MCDBA
> Microsoft Online Partner Support
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ========================================
=============
>
> This posting is provided "AS IS" with no warranties, and confers no rights
.
>
> --
>
An 'OnClientConnected' on the Server side
-equivalent event on the server side that I can put some code to check who
has just connected or what application or workstation is connecting? I'm
looking for some way to check for 'valid' client applications.
You can execute queries to view connection, session
information. In SQL Server 2000, query the sysprocesses
table in the master database. In SQL Server 2005, you can
query the dynamic management view sys.dm_exec_sessions. Both
have login times, host, program name and other info.
What you do from there depends on what you are trying to do
and what version of SQL Server may determine what options
are available to use.
-Sue
On Tue, 14 Feb 2006 13:25:28 -0800, "Trex"
<Trex@.community.nospam> wrote:
>Upon a client connecting to the server, is there an 'OnClientConnected'
>-equivalent event on the server side that I can put some code to check who
>has just connected or what application or workstation is connecting? I'm
>looking for some way to check for 'valid' client applications.
|||Hello Trex,
You may want to consider to capture the audit logon/logoff event and store
them to a SQL table. Then you could use notification service to notfiy when
the insertion meets to requirment.
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ===
This posting is provided "AS IS" with no warranties, and confers no rights.
--
>Thread-Topic: An 'OnClientConnected' on the Server side
>thread-index: AcYxrS0jasuUvcWgTpCZHnrqfgbL3A==
>X-WBNR-Posting-Host: 152.130.15.18
>From: "=?Utf-8?B?VHJleA==?=" <Trex@.community.nospam>
>Subject: An 'OnClientConnected' on the Server side
>Date: Tue, 14 Feb 2006 13:25:28 -0800
>Lines: 4
>Message-ID: <C4E19CC4-603C-4FD8-8044-96A28661C246@.microsoft.com>
>MIME-Version: 1.0
>Content-Type: text/plain;
>charset="Utf-8"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>Content-Class: urn:content-classes:message
>Importance: normal
>Priority: normal
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
>Newsgroups: microsoft.public.sqlserver.connect
>NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
>Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
>Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.sqlserver.connect:46902
>X-Tomcat-NG: microsoft.public.sqlserver.connect
>Upon a client connecting to the server, is there an 'OnClientConnected'
>-equivalent event on the server side that I can put some code to check who
>has just connected or what application or workstation is connecting? I'm
>looking for some way to check for 'valid' client applications.
>
|||Sounds like a solution. I can monitor this and kill a process if I don't
like what I see. Thank you Sue!
"Sue Hoegemeier" wrote:
> You can execute queries to view connection, session
> information. In SQL Server 2000, query the sysprocesses
> table in the master database. In SQL Server 2005, you can
> query the dynamic management view sys.dm_exec_sessions. Both
> have login times, host, program name and other info.
> What you do from there depends on what you are trying to do
> and what version of SQL Server may determine what options
> are available to use.
> -Sue
> On Tue, 14 Feb 2006 13:25:28 -0800, "Trex"
> <Trex@.community.nospam> wrote:
>
>
|||Thank you Peter...this may be another possiblity for me!
"Peter Yang [MSFT]" wrote:
> Hello Trex,
> You may want to consider to capture the audit logon/logoff event and store
> them to a SQL table. Then you could use notification service to notfiy when
> the insertion meets to requirment.
> Best Regards,
> Peter Yang
> MCSE2000/2003, MCSA, MCDBA
> Microsoft Online Partner Support
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ================================================== ===
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> --
>
sql
Saturday, February 25, 2012
AMO:How to do ProcessPartition by using AMO
Hi All,
i need a sample code how we can do process the partition by using AMO.
Please send the sample code.
Hi there,You can take a look here for some sample code..
Chris.
|||
Hi,
Another sample code here: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=516918&SiteID=1
AMO: Merging Partitions
Does anybody have a sample AMO code for merging two existing partitions through AMO? Please help.
Thanks,
Nagy
Copied from http://technet.microsoft.com/en-us/library/ms345091.aspx
Merging Partitions
Merging partitions means performing any operation that results in two or more partitions becoming one partition.
Merging partitions is a method of the Partition object. This command merges the data of one or more source partitions into a target partition and deletes the source partitions.
Partitions can be merged only if they meet all the following criteria:
Partitions are in the same measure group.Partitions are stored in the same mode (MOLAP, HOLAP, and ROLAP).
Partitions reside on the same server; remote partitions can be merged if on the same server.
|||
Thanks for your reply Adrian. This merges all the partitions in a measure group into one. What is the code to merge Partition_a with Partition_b when my measure group has Partition_a, Partition_b, Partition_c, Partition_d?
Regards,
Nagy
|||If you want to merge A and B into A, create an array of size 1 with B and call Merge on partition A with that array.
The Merge method will merge the specified collection of Partitions (the sources) into the Partition on which is called (the destination).
Adrian Dumitrascu
AMO: Looping to delete partitions
Hi
I am trying - in AMO code - to loop over the partitions in my different measure groups and drop these. But apparently I am not allowed to do it with the following code, since I am modifying the collection which I am looping (because I drop the partitions which exist in the collection).
....
For Each oMeasuregroup in oCube.MeasureGroups
For Each oPartition in oMeasureGroup.Partitions
oPartition.Drop()
Next
Next
...
Can anyone help me with a solution? Thanks.
Hi,
You need to iterate over the partitions collection with integer index.
PartitionCollection partitions = ...;
for( int i=partitions.Count-1; i>=0; --i )
partitions[ i ].Drop();
Adrian Dumitrascu
Friday, February 24, 2012
AMO: Hanging on Partition.Update
I am using AMO to manage partitions.
I am trying to create a partition then use the Update method to create the new partition.. snippet of code below:
65 //create the new partition
66 Partition newPartition = mg.Partitions.Add(partitionName, partitionName);
67 newPartition.StorageMode = StorageMode.Molap;
68 newPartition.Source = new QueryBinding(db.DataSources[0].ID, bindingQuery);
69 XmlaWarningCollection warnings = new XmlaWarningCollection();
70
71 newPartition.Update(UpdateOptions.Default,UpdateMode.Create,warnings);
72 //TODO: Deal with warnings
Every time I run it, it just hangs on the Update method. It seems to be looping.. the query execution will only stop when I restart the SSAS Service.
No errors, no log entries, no Event Log entries.... nada, zilch, vacuum, nothing......
Any ideas anyone?
BTW: This is the SP2 CTP.. I think this might be a bug...|||It sounds like a bug, it should not hang indefinitely. It would be a good idea to post this on the connect site if it is not already there.
In the mean time, have you tried calling Update() at the cube level, not on the partition object? This is the pattern that the AmoAdventureWorks sample uses (one of the AMO samples distributed with SQL Server), they don't actually call update on the partitions or measure groups, calling update at the cube level causes the changes to all the child objects to get persisted.
|||OK.. I'll give that a whirl... I do seem to be spending an awful lot of time at the connect site lately...Changed the code to the following:
65 //create the new partition
66 Partition newPartition = mg.Partitions.Add(partitionName, partitionName);
67 newPartition.StorageMode = StorageMode.Molap;
68 newPartition.Source = new QueryBinding(db.DataSources[0].ID, bindingQuery);
69 XmlaWarningCollection warnings = new XmlaWarningCollection();
70
71 cube.Update(UpdateOptions.ExpandFull,UpdateMode.CreateOrReplace);
72 //newPartition.Update(UpdateOptions.Default,UpdateMode.Create,warnings);
73 //TODO: Deal with XmlaWarningCollection warnings
But the answer is still no.. it hangs on the update cube method too.. I can see a CommandBegin in the trace with the following XMLA:
<Create AllowOverwrite="true" xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
...
and the details for the new partition is indeed included in the XMLA...but nothing happens .. it is still hanging... no errors, no logs.. the CPU for the SSAS service is zero with the memory stationary.
When I try to look at anything to do with the SSAS database in the SQL Server Management studio, it just hangs.
This is getting serious!
|||This is probably a silly question, but can I just confirm that you are in fact using the Enterprise edition of SQL Server? Partitions are an Enterprise only feature and if you try to deploy them to a Standard edition server you will get unpredictable results.
I don't know if you have tried this yet, but I have seen one other case where we had symptoms similar to this, simple "alter" statements were causing the server to "hang". We were lucky that this was a dev environment and deleting the database first and then fully re-deploying appeared to fix this, but I have not yet been able to identify what triggered this behaviour.
|||This is currently the developer edition, SP2 CTP which I am using as a local dev environment. I don't yet have a proper server environment in which to run tests.
From my understanding developer edition has alll the functionality of the Enterprise edition (?)
|||You are correct. The Developer edition has the same functionality as the Enterprise edition.
I don't know if this is possible, but could you create a partition manually and trace the xmla that is generated using profiler and then run your program and trace that and see if the xmla that is produced is different? That might help highlight something that you might need to add or change to get things working.
AMO with SQL2000
You will need to upgrade to AS2005. Here's some relevent info.
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1606122&SiteID=1
|||Yan is right,
AMO = AS2005 administrative API
DSO = AS2000 administrative API
But you should not have too much trouble using DSO from C# as VS.NET will generate a RCW (Runtime COM Wrapper) for you. If you are comfortable with VB.NET it might be a slightly better choice for coding against a COM library as it has better support for optional parameters and a few other things that were common in COM libraries.
But I have used C# against other COM dlls and most of the time it is not an issue and the optional parameter thing can be overcome by simply typing in all the default parameters, it's not incorrect, I just find VB.NET "cleaner" when working against COM DLLs, but that could be just me.
AMO Role drop trouble
Role oCurrentRole = oOLAPDB.Roles.GetByName(<role name>);
oCurrentRole.Drop(DropOptions.AlterOrDeleteDependents);
Most of the time it's OK but I've sometimes this error
Exception non gre : System.InvalidOperationException: Impossible de supprimer l'objet ? Role ?my role , il doit faire partie d'un objet Server connect.
à Microsoft.AnalysisServices.MajorObject.DropPrivate(DropOptions options, XmlaWarningCollection warnings, ImpactDetailCollection impactResult, Boolean analyzeImpactOnly)
à Microsoft.AnalysisServices.MajorObject.Drop(DropOptions options)
(in english: Unhandled exception : System.InvalidOperationException: Unable to drop ? Role object ?my role , it must be part of a connected Server object)
I'm the only one connected to this server and I'm sure this role isn't used.
One thing to mention: It seems I've this error only with roles with members which are no more existing in the domain (they were when the role was created but get deleted later).
Any idea ? How could I drop these roles with AMO ?
David,
I created an account on my local system, JunkUser, and then created a role in Adventure Works DW called JunkRole. JunkUser is the lone member of this role. I then dropped the JunkUser account from my system.
In SSIS, I created a package with a single Script task. I added the AMO reference and an Imports statement to simplify my code. In Sub Main, I added this code:
Code Snippet
Dim MyServer As New Server
MyServer.Connect(".")
Dim MyDatabase As Database = MyServer.Databases.GetByName("Adventure Works DW")
Dim MyRole As Role = MyDatabase.Roles.GetByName("JunkRole")
MyRole.Drop(DropOptions.AlterOrDeleteDependents)
MyServer.Disconnect()
I executed the SSIS package. It completed successsfully and I verified the JunkRole had been dropped.
I am running on SP2.
Not sure what might else may be causing the problem you are seeing.
B.
|||My bad
You're right Bryan, it doens't matter if the user has been deleted or not
In fact, I had a nice
oServer.Disconnect();
just before my code... And of course, oServer is my OLAP Server object... Now that I'm thinking about it, the error message was quite explicit ("...connected Server")
AMO "Scripter" Class - Help
Has anyone ever used Microsoft.AnalysisServices.Scripter class to programtically script SSAS objects? I am looking for a little bit of sample code to get me started. My goal here is to script some of the SSAS objects out into XML and store the XML in a table that can be queried to produce some meta data reports. I plan on doing this using AMO inside of a Script Task of a SSIS package.
So here are my two main questions:
- Can anyone provide me with some sample code (I am not that good with .NET) using the Scripter class to script an SSAS object? Can anyone tell me a better way to build reports based on the meta data of my SSAS objects?
Thank you in advance!
Here is some sample code to use Scripter to script Alter command for your database into a file. You can later have SSIS to load content of the file into a table.
using Microsoft.AnalysisServices;
........
XmlTextWriter xmlwrite = new XmlTextWriter( "MyDatabase.XMLA", System.Text.Encoding.UTF8);
xmlwrite.Formatting = Formatting.Indented;
xmlwrite.Indentation = 2;
Scripter.WriteAlter(xmlwrite, myDataBase, true, true);
xmlwrite.Close();
|||
Edward,
Thanks for the code sample. This should do the trick. However, I have one more follow up question for you. How do I write the XML into a String variabe instead of to a file? Thanks again.
|||Take a look at the functionality provided to you by XMLTextWriter.
http://msdn2.microsoft.com/en-us/system.xml.xmltextwriter.aspx
You shoudl be able to use different constructor for it.Search for sample of using XMLTextWriter.
Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Edward,
Thanks again for the help. Here is the code that I came up with, it is in VB.NET and will work inside of a SSIS Script Task. It should help anyone trying to do the same thing. Thanks you for your help on this one.
' Microsoft SQL Server Integration Services Script Task
' Write scripts using Microsoft Visual Basic
' The ScriptMain class is the entry point of the Script Task.
Imports System
Imports System.IO
Imports System.Data
Imports System.Math
Imports System.Xml
Imports System.Data.SqlClient
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.AnalysisServices
Class ScriptMain
Public Sub Main()
' Get Server and Database name from DTS connection object
Dim oDTSASConnection As ConnectionManager = Dts.Connections("AS Server")
Dim sASServer As String = CStr(oDTSASConnection.Properties("ServerName").GetValue(oDTSASConnection))
Dim oASServer As New Microsoft.AnalysisServices.Server
' Connect to the requested server
oASServer.Connect(sASServer)
' Loop trough all of the dbs on the server and write xmla to db
Dim oASDatabase As New Microsoft.AnalysisServices.Database
For Each oASDatabase In oASServer.Databases
Call ScriptASDatabase(oASServer, oASDatabase)
'' Loop trough all of the cubes in the db and write xmla to db
Dim oASCube As New Microsoft.AnalysisServices.Cube
For Each oASCube In oASDatabase.Cubes
Call ScriptASCube(oASServer, oASDatabase, oASCube)
Next
' Loop trough all of the dimensions in the db and write xmla to db
Dim oASDim As New Microsoft.AnalysisServices.Dimension
For Each oASDim In oASDatabase.Dimensions
Call ScriptASDim(oASServer, oASDatabase, oASDim)
Next
Next
' Clean Up
oASServer.Disconnect()
Dts.TaskResult = Dts.Results.Success
End Sub
Public Sub ScriptASDatabase(ByVal oASServer As Microsoft.AnalysisServices.Server, ByVal oASDatabase As Microsoft.AnalysisServices.Database)
' Create wrtiters and set formating for xml
Dim stringWriter As New System.IO.StringWriter()
Dim xmlWriter As New System.Xml.XmlTextWriter(stringWriter)
xmlWriter.Formatting = Formatting.Indented
xmlWriter.Indentation = 2
Dim sXMLA As String
' Script dbs on the server and write to db
Scripter.WriteCreate(xmlWriter, oASServer, oASDatabase, False, False)
sXMLA = stringWriter.ToString
Call DBUpsert(oASServer.Name.ToString, oASDatabase.Name.ToString, oASDatabase.Name.ToString, oASDatabase.ID.ToString, oASDatabase.ID.ToString, "Database", sXMLA.ToString)
' Clean Up
stringWriter.Close()
xmlWriter.Close()
End Sub
Public Sub ScriptASCube(ByVal oASServer As Microsoft.AnalysisServices.Server, ByVal oASDatabase As Microsoft.AnalysisServices.Database, ByVal oASCube As Microsoft.AnalysisServices.Cube)
'Create wrtiters and set formating for xml
Dim stringWriter As New System.IO.StringWriter()
Dim xmlWriter As New System.Xml.XmlTextWriter(stringWriter)
xmlWriter.Formatting = Formatting.Indented
xmlWriter.Indentation = 2
Dim sXMLA As String
' Script cubes in the db and write to db
Scripter.WriteCreate(xmlWriter, oASDatabase, oASCube, False, False)
sXMLA = stringWriter.ToString
Call DBUpsert(oASServer.Name.ToString, oASDatabase.Name.ToString, oASCube.Name.ToString, oASCube.ID.ToString, oASCube.Parent.ID.ToString, "Cube", sXMLA.ToString)
' Clean Up
stringWriter.Close()
xmlWriter.Close()
End Sub
Public Sub ScriptASDim(ByVal oASServer As Microsoft.AnalysisServices.Server, ByVal oASDatabase As Microsoft.AnalysisServices.Database, ByVal oASDim As Microsoft.AnalysisServices.Dimension)
'Create wrtiters and set formating for xml
Dim stringWriter As New System.IO.StringWriter()
Dim xmlWriter As New System.Xml.XmlTextWriter(stringWriter)
xmlWriter.Formatting = Formatting.Indented
xmlWriter.Indentation = 2
Dim sXMLA As String
' Script cubes in the db and write to db
Scripter.WriteCreate(xmlWriter, oASDatabase, oASDim, True, False)
sXMLA = stringWriter.ToString
Call DBUpsert(oASServer.Name.ToString, oASDatabase.Name.ToString, oASDim.Name.ToString, oASDim.ID.ToString, oASDim.Parent.ID.ToString, "Dimension", sXMLA.ToString)
' Clean Up
stringWriter.Close()
xmlWriter.Close()
End Sub
Public Sub DBUpsert(ByVal sASServer As String, ByVal sASDatabase As String, ByVal sASName As String, ByVal sID As String, ByVal sParentID As String, ByVal sObjectType As String, ByVal sXMLA As String)
' Create a connection to the db
Dim oDTSDBConnection As Microsoft.SqlServer.Dts.Runtime.ConnectionManager = Dts.Connections("Local.MetaData")
Dim sDBServer As String = CStr(oDTSDBConnection.Properties("ServerName").GetValue(oDTSDBConnection))
Dim sDBDatabase As String = CStr(oDTSDBConnection.Properties("InitialCatalog").GetValue(oDTSDBConnection))
Dim oBuilder As New SqlConnectionStringBuilder()
oBuilder.DataSource = sDBServer
oBuilder.InitialCatalog = sDBDatabase
oBuilder.ConnectTimeout = 1000
oBuilder.IntegratedSecurity = True
oBuilder.ApplicationName = "ImportSSASXml"
Dim oDBConnection As New SqlConnection(oBuilder.ConnectionString.ToString)
' Create Sql Command
Dim cmd As New SqlCommand("dbo.etl_ImportSSASXml", oDBConnection)
cmd.CommandTimeout = 60
cmd.Connection = oDBConnection
cmd.CommandType = CommandType.StoredProcedure
' Add parameters and their values
cmd.Parameters.Add(New SqlParameter("@.Server", SqlDbType.VarChar, 255)).Value = sASServer
cmd.Parameters.Add(New SqlParameter("@.Database", SqlDbType.VarChar, 255)).Value = sASDatabase
cmd.Parameters.Add(New SqlParameter("@.Name", SqlDbType.VarChar, 255)).Value = sASName
cmd.Parameters.Add(New SqlParameter("@.ID", SqlDbType.VarChar, 255)).Value = sID
cmd.Parameters.Add(New SqlParameter("@.ParentID", SqlDbType.VarChar, 255)).Value = sParentID
cmd.Parameters.Add(New SqlParameter("@.ObjectType", SqlDbType.VarChar, 255)).Value = sObjectType
cmd.Parameters.Add(New SqlParameter("@.XMLA", SqlDbType.VarChar)).Value = sXMLA
' Open the connection
oDBConnection.Open()
' Execute the command
cmd.ExecuteNonQuery()
' Clean Up
oDBConnection.Close()
End Sub
End Class
I will be posting a comprehensive solution to building meta data reports on/about ones' SSAS objects on my blog in the next few weeks. Check it out if you are interested!
Sunday, February 19, 2012
AMO <-> XMLA serialization?
I'm in the process of developing additional tooling to help auto-partition my cube, and I've developed some AMO code to connect to my AS database to do this.
What I'm worried about is the fact that there's no good way to keep my online instance in sync with the persisted source code. IE, if I make a change in dev mode and re-deploy, all my auto-created partitions will be destroyed.
What's the best way to deal w/ this? I suppose I could constantly re-generate a BIDS project from the server every time I wanted to make a change. Or, if there was some way to deserialize the BIDS project files (since they're all XMLA anyway), I could apply my AMO code to the updated the XMLA object definitions.
Have you looked at the Deployment Wizard. I am pretty sure it has the option of deploying a solution without overwritting the existing partitions.ambiguous?
Code Snippet
select distinct j.eventid
from oppositeleptons j
where dbo.invmass(j.l1Ee,j.l2Ee,j.l1px,j.l2px,j.l1py,
j.l2py,j.l1pz,j.l2pz,91.1882)<10;
GO
and it throw me this error message
Msg 4121, Level 16, State 1, Procedure EvInvMass, Line 3
Cannot find either column "dbo" or the user-defined function or aggregate "dbo.invmass", or the name is ambiguous.
the fact is.... theres no DBO column in oppositeleptons, so why this ambiguity?
the problem is that the function "dbo.invmass" does not exist
Check the owner of the function.. it needs to be called as
<owner>.invmass
where <owner> usually is dbo but it depends who created it and how.
Ambiguous match found.
Ambiguous match found.
i'm using sql server 2000
here is my code
Dim con As SqlConnection = New SqlConnection
con.ConnectionString = _
"Data Source=localhost;" + _
"Initial Catalog=registeruser;" + _
"User ID=int422;" + _
"Password=int422"
Dim cmd As SqlCommand = New SqlCommand
cmd.Connection = con
cmd.CommandType = CommandType.Text
cmd.CommandText = "SELECT salt,hash FROM users WHERE login_id = '" + user.Text + "'"
Dim rdr As SqlDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
con.Open()
Dim salt, hash As String
While rdr.Read()
If user.Text = rdr.Item("login_id").ToString() Then
salt = rdr.Item("salt").ToString()
hash = rdr.Item("hash").ToString()
End If
End While
con.Close()
Label1.Text = salt
End SubAre you sure that SQL statement is what is really getting called in your code ?
rdr.Item("login_id") wouldn't exist in the data reader as you have only selected "salt" and "hash".
<MindReading
My guess is, you haven't posted the SQL statement you are really using, you are using something with a JOIN in it and you are doing a SELECT * in there.
In your result set from the SQL statement, you have two columns called "login_id" so the dataReader doesn't know which one to reference.
If you change your SQL statement to only return the fields you want, you shouldn't have the problem
i.e. SELECT salt,hash, users.login_id FROM users INEER JOIN Blah etc etc
</MindReading
Thursday, February 9, 2012
Alternative to cursor
I would like to find and alternative to using a cursor and updating my
table with the calculated values. The following code snippet is from my
store procedure.
-- Calculate and Update LEWeightedTerm and LEWeightedRR
DECLARE LECursor CURSOR FOR
SELECT TransactionID, Term, BusinessUnitID, LEAlloc, CalcODRBefore
FROM stage_DealTransaction
WHERE COBDateID = @.COBDateID AND LEWeightedTerm is null AND
LEWeightedRR is null
OPEN LECursor
DECLARE @.tranID AS int
DECLARE @.term AS int
DECLARE @.LEAlloc AS float
DECLARE @.BUID AS varchar(15)
DECLARE @.ODR AS Varchar(2)
DECLARE @.LEWT AS float
DECLARE @.LEWRR AS float
DECLARE @.LEAllocSum AS float
DECLARE @.rate AS float
FETCH NEXT FROM LECursor
INTO @.tranID, @.term, @.BUID, @.LEAlloc, @.ODR
While (@.@.FETCH_STATUS <> -1)
BEGIN
IF (@.@.FETCH_STATUS <> -2)
BEGIN
SET @.LEAllocSum = 1
IF (@.BUID IS NOT NULL)
BEGIN
SELECT @.LEAllocSum = SUM(ISNULL(LEAlloc, 0)) FROM DealTransaction
WHERE BusinessUnitID = @.BUID AND COBDateID = @.COBDateID
END
IF (@.LEAllocSum = 0)
BEGIN
SET @.LEAllocSum = 1
END
IF (@.LEAlloc IS NULL)
BEGIN
SET @.LEAlloc = 0
END
SET @.LEWT = (@.LEAlloc * ISNULL(@.term, 0)) / @.LEAllocSum
SET @.rate = CONVERT(float, ISNULL(@.ODR, '41'))
SET @.LEWRR = (@.LEAlloc * @.rate) / @.LEAllocSum
UPDATE stage_DealTransaction SET LEWeightedTerm = @.LEWT ,
LEWeightedRR = @.LEWRR WHERE TransactionID = @.tranID AND COBDateID =
@.COBDateID
END
FETCH NEXT FROM LECursor INTO @.tranID, @.term, @.BUID, @.LEAlloc, @.ODR
END
CLOSE LECursor
DEALLOCATE LECursor
I would like to find a way to optimize it so that the updates can be
done in bulk rather than one record at a time.
Any feedback would be highly appreciated.
Thank you,
Zubinezubine@.gmail.com wrote:
> Hello,
> I would like to find and alternative to using a cursor and updating my
> table with the calculated values. The following code snippet is from
> my store procedure.
>
Could you summarize what you need this to do rather than making us analyze
the cursor code?
It always help to provide DDL and sample data as well. See
www.aspfaq.com/5006 for suggestions
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.|||On 18 Nov 2005 07:04:41 -0800, zubine@.gmail.com wrote:
>Hello,
>I would like to find and alternative to using a cursor and updating my
>table with the calculated values. The following code snippet is from my
>store procedure.
Hi Zubine,
Try the following:
UPDATE s
SET LEWeightedTerm = COALESCE (s.LEAlloc * s.Term), 0)
/ COALESCE(NULLIF(dt.SumLEAlloc, 0), 1),
LEWeightedRR = COALESCE (s.LEAlloc *
CAST(COALESCE(s.CalcODRBefore, '41') AS float)), 0)
/ COALESCE(NULLIF(dt.SumLEAlloc, 0), 1)
FROM stage_DealTransaction AS s
LEFT JOIN (SELECT BusinessUnitID,
SUM(LEAlloc) AS SumLEAlloc
FROM DealTransaction
WHERE dt.COBDateID = @.COBDateID
GROUP BY BusinessUnitID) AS dt
ON dt.BusinessUnitID = s.BusinessUnitID
WHERE s.COBDateID = @.COBDateID
AND s.LEWeightedTerm IS NULL
AND s.LEWeightedRR IS NULL
Depending on how your tables and data look, you might be able to replace
the LEFT JOIN with an INNER JOIN, and that might speed up the execution
as well.
Note that the stattement above is untested. See www.aspfaq.com/5006 if
you prefer a tested reply.
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)
alternative for crystal NEXT function
Is there any alternative in SSRS 2000 for the NEXT function of Crystal. Or
can someone provide a code snippet or logic for the same.
--
Afaq ChoonawalaI am sorry, my Crystal knowledge is a little vague at this moment :-) Can
you tell us what this function does?
--
HTH,
---
Teo Lachev, MVP, MCSD, MCT
"Microsoft Reporting Services in Action"
"Applied Microsoft Analysis Services 2005"
Home page and blog: http://www.prologika.com/
---
"Afaq" <Afaq@.discussions.microsoft.com> wrote in message
news:00748057-0DC5-4EE3-8C6D-A31EEEF1CA98@.microsoft.com...
> Hi,
> Is there any alternative in SSRS 2000 for the NEXT function of Crystal. Or
> can someone provide a code snippet or logic for the same.
> --
> Afaq Choonawala|||u can check the value any column in the next record while still being on the
current record
"Teo Lachev [MVP]" wrote:
> I am sorry, my Crystal knowledge is a little vague at this moment :-) Can
> you tell us what this function does?
> --
> HTH,
> ---
> Teo Lachev, MVP, MCSD, MCT
> "Microsoft Reporting Services in Action"
> "Applied Microsoft Analysis Services 2005"
> Home page and blog: http://www.prologika.com/
> ---
> "Afaq" <Afaq@.discussions.microsoft.com> wrote in message
> news:00748057-0DC5-4EE3-8C6D-A31EEEF1CA98@.microsoft.com...
> > Hi,
> >
> > Is there any alternative in SSRS 2000 for the NEXT function of Crystal. Or
> > can someone provide a code snippet or logic for the same.
> > --
> > Afaq Choonawala
>
>|||There is no alternative for forward or random navigation. There is a
Previous function but it is an opposite of what you are trying to
accomplish. I hope a future release of RS would give us access to the
dataset before it is "bound" to the region, e.g. similar to binding ASP.NET
user controls. For the time being, consider bringing the the next record
value in the current record by transforming data at the data source.
--
HTH,
---
Teo Lachev, MVP, MCSD, MCT
"Microsoft Reporting Services in Action"
"Applied Microsoft Analysis Services 2005"
Home page and blog: http://www.prologika.com/
---
"Afaq" <Afaq@.discussions.microsoft.com> wrote in message
news:408D700E-F282-467E-8B89-85D779958F4D@.microsoft.com...
>u can check the value any column in the next record while still being on
>the
> current record
>
> "Teo Lachev [MVP]" wrote:
>> I am sorry, my Crystal knowledge is a little vague at this moment :-) Can
>> you tell us what this function does?
>> --
>> HTH,
>> ---
>> Teo Lachev, MVP, MCSD, MCT
>> "Microsoft Reporting Services in Action"
>> "Applied Microsoft Analysis Services 2005"
>> Home page and blog: http://www.prologika.com/
>> ---
>> "Afaq" <Afaq@.discussions.microsoft.com> wrote in message
>> news:00748057-0DC5-4EE3-8C6D-A31EEEF1CA98@.microsoft.com...
>> > Hi,
>> >
>> > Is there any alternative in SSRS 2000 for the NEXT function of Crystal.
>> > Or
>> > can someone provide a code snippet or logic for the same.
>> > --
>> > Afaq Choonawala
>>|||Not sure if you will find this useful for your situation or not, but I am in
the process of converting our reports from Crystal Reports to SQL Server
Reporting Services and I came up with the following alternative for the NEXT
function in our situation.
Many of our reports consist of multiple groups with subtotals and grand
totals in the group footers. On some of the CR reports, we have a
conditional page break which forces a page break only if the NEXT group value
is equal to the current value. For example: {@.Bank_Name/Bank_HEADER} = Next
({@.Bank_Name/Bank_HEADER})
This prevents a group footer from appearing on a single page by itself.
My SSRS solution is to place all the group footer information in the
innermost group footer, but within their own individual table rows with the
innermost group footer's Page break at End property checked. Then I define
the table row's hidden property to an expression which evaluates the row
number of the group with the row count of the group, such as
=(RowNumber("table1_Group2")<>CountRows("table1_Group2")).
My Group 1 and Report Footers row hidden properties have the following
respective expressions:
=(RowNumber("table1_Group1")<>CountRows("table1_Group1"))
=(RowNumber("table1")<>CountRows("table1"))
As for the aggregate functions in each of the table rows, I apply the same
scope values to achieve the Group 2, Group 1, and report totals as in:
=Count(Fields!Formula_Acct_Num.Value, "table1_Group2")
=Count(Fields!Formula_Acct_Num.Value, "table1_Group1")
=Count(Fields!Formula_Acct_Num.Value, "table1")
= Sum(Fields!Formula_Balance.Value, "table1_Group2")
= Sum(Fields!Formula_Balance.Value, "table1_Group1")
= Sum(Fields!Formula_Balance.Value, "table1")
Enjoy!
"Teo Lachev [MVP]" wrote:
> There is no alternative for forward or random navigation. There is a
> Previous function but it is an opposite of what you are trying to
> accomplish. I hope a future release of RS would give us access to the
> dataset before it is "bound" to the region, e.g. similar to binding ASP.NET
> user controls. For the time being, consider bringing the the next record
> value in the current record by transforming data at the data source.
> --
> HTH,
> ---
> Teo Lachev, MVP, MCSD, MCT
> "Microsoft Reporting Services in Action"
> "Applied Microsoft Analysis Services 2005"
> Home page and blog: http://www.prologika.com/
> ---
> "Afaq" <Afaq@.discussions.microsoft.com> wrote in message
> news:408D700E-F282-467E-8B89-85D779958F4D@.microsoft.com...
> >u can check the value any column in the next record while still being on
> >the
> > current record
> >
> >
> > "Teo Lachev [MVP]" wrote:
> >
> >> I am sorry, my Crystal knowledge is a little vague at this moment :-) Can
> >> you tell us what this function does?
> >>
> >> --
> >> HTH,
> >> ---
> >> Teo Lachev, MVP, MCSD, MCT
> >> "Microsoft Reporting Services in Action"
> >> "Applied Microsoft Analysis Services 2005"
> >> Home page and blog: http://www.prologika.com/
> >> ---
> >> "Afaq" <Afaq@.discussions.microsoft.com> wrote in message
> >> news:00748057-0DC5-4EE3-8C6D-A31EEEF1CA98@.microsoft.com...
> >> > Hi,
> >> >
> >> > Is there any alternative in SSRS 2000 for the NEXT function of Crystal.
> >> > Or
> >> > can someone provide a code snippet or logic for the same.
> >> > --
> >> > Afaq Choonawala
> >>
> >>
> >>
>
>