MS SQL SERVER: Programming sql server data mining


Published on

MS SQL SERVER: Programming sql server data mining

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

MS SQL SERVER: Programming sql server data mining

  1. 1. Programming SQL Server Data Mining<br />
  2. 2. overview<br />Data Mining APIs<br />Programming AMO Data Mining Objects<br />Stored Procedures<br />Creating Stored Procedures<br />Executing Stored Procedures<br />Deploying and Debugging Stored Procedure Assemblies<br />Summary<br />
  3. 3. Data Mining APIs<br />The major APIs used in Analysis Services programming.<br />
  4. 4. Data Mining APIs<br />The major APIs used in Analysis Services programming.<br />
  5. 5. Data Mining APIs<br />
  6. 6. Programming AMO Data Mining Objects<br /> steps in programming data mining objects by using AMO <br /><ul><li>create the data structure model.
  7. 7. create the data mining model that supports the mining algorithm you want to use in order to predict or to find the relationships underlying your data.
  8. 8. process the mining models to obtain the trained models that you will use later when querying and predicting from the client application.</li></ul>Note: AMO is not for querying; AMO is for managing and administering your mining structures and models.<br /> To query your data, use ADOMD.NET<br />
  9. 9. Mining Structure Objects<br /> A mining structure contains a binding to a data source view that is defined in the database, and contains definitions for all columns participating in the mining models <br />Steps followed to Creating a MiningStructure object are:<br /><ul><li>Create the MiningStructure object and populate the basic attributes
  10. 10. Create columns for the model. Each column needs a name and internal ID, a type, a content definition, and a binding.
  11. 11. Update the MiningStructure object to the server, by using the Update method of the object.</li></li></ul><li>MiningModel Objects<br />Steps to create a MiningModel object :<br /><ul><li>Create the MiningModel object and populate the basic attributes. (object name, object ID, and mining algorithm specification)
  12. 12. Add the columns of the mining model. </li></ul> One of the columns must be defined as the case key.<br /><ul><li>Update the MiningModel object to the server, by using the Update method of the object.MiningModel objects can be processed independently of other models in the parent MiningStructure.</li></li></ul><li>Stored Procedures<br /><ul><li>Stored procedures can be used to call external routines from Microsoft SQL Server Analysis Services
  13. 13. You can write an external routines called by a stored procedure in any common language runtime (CLR) language, such as C, C++, C#, Visual Basic, or Visual Basic .NET.
  14. 14. Stored procedures can be used to add business functionality to your applications that is not provided by the native functionality of MDX</li></li></ul><li>Creating Stored Procedures<br />All stored procedures must be associated with a common language runtime (CLR) or Component Object Model (COM) class in order to be used. <br />The class must be installed on the server — usually in the form of a Microsoft ActiveX® dynamic link library (DLL) — and registered as an assembly on the server or in an Analysis Services database.<br />Server stored procedures can be called from any query context.<br /> Database stored procedures can only be accessed if the database context is the database under which the stored procedure is defined.<br /> For a server or a deployed Microsoft SQL Server Analysis Services database on a server, you can use SQL Server Management Studio to register an assembly. <br />For an Analysis Services project, you can use Analysis Services Designer to register an assembly in the project.<br />
  15. 15. Executing Stored Procedures<br />Server ADOMD.NET allows you to execute DMX queries using the same objects that you would use with ADOMD.NET.<br />The only exception is that you do not have to specify a connection, because you are already connected. <br />You can copy the results from the query into a DataTable, or you can simply return the DataReader returned by ExecuteReader.<br />
  16. 16. Deploying and Debugging Stored Procedure Assemblies<br />After Compiling and building the stored procedure, you must deploy the procedure to your Analysis Server in order to call it from DMX. <br />To add a .NET assembly to your Analysis Services project, right-click the Assemblies folder in Solution Explorer and select New Assembly Reference.<br />select some security-related options, such as Permissions and Impersonation information. <br />The Permissions property specifies the code access permissions that are granted to the assembly when it’s loaded by Analysis Services. <br />The recommended (and default) value is Safe.<br />
  17. 17. Deploying and Debugging Stored Procedure Assemblies<br />To debug the assembly in Visual Studio, select Attach to Process from the Debug menu. <br />Select the executable msmdsrv.exe from the list, and ensure that the dialog box displays CLR as the Attach To option. <br />you will be able to set breakpoints in your stored procedures at the end.<br />
  18. 18. Major Data Mining APIs<br />Programming AMO Data Mining Objects<br />Stored Procedures basics<br />Deploying and Debugging Stored Procedure Assemblies<br />Summary<br />
  19. 19. Visit more self help tutorials<br />Pick a tutorial of your choice and browse through it at your own pace.<br />The tutorials section is free, self-guiding and will not involve any additional support.<br />Visit us at<br />