none
DELETE for DM-models RRS feed

  • Question

  • Hi
    if command ADD we can create DM-model, example

    alter mining structure Test add mining model TestModel ([id], Product predict, Customer predict)
    using Microsoft_Clustering (Cluster_Count = 4, Modelling_Cardinality = 50, Stopping_Tolerance = 1, Clustering_Method = 3) with drillthrough;

    How DELETE created model ?
    and
    how know about its existig ? (example, EXIST (....) ?

    Thanks
    Thursday, May 28, 2009 6:02 AM

All replies

  • For deletion:
    DROP MINING MODEL TestModel

    For existence, in SQL Server 2008 you can do something like
    SELECT MODEL_NAME FROM $SYSTEM.DMSCHEMA_MINING_MODELS WHERE MODEL_NAME='TestModel'
    bogdan crivat [sql server data mining] / http://www.bogdancrivat.net/dm
    Thursday, May 28, 2009 8:49 PM
    Moderator
  • Thanks, but this commands work in MDXQuery

    When I try exec next in T-SQL

    IF

    not EXISTS (SELECT * FROM sys.servers WHERE name = 'SEATTLESales1')
    EXEC sp_addlinkedserver
    @server='SEATTLESales1', -- THat is name that you will call this new server
    @srvproduct='', @provider='MSOLAP', @datasrc='SZ7',  @catalog='ADB'
    GO

    EXEC

    sp_serveroption 'SEATTLESales1', 'rpc out', true
    GO

    Declare

    @mS varchar

    Set

    @mS = 'alter mining structure Test add mining model TestMode2224 ([Field Key], P predict, T predict)
    using Microsoft_Clustering (Cluster_Count = 4, Modelling_Cardinality = 50, Stopping_Tolerance = 1, Clustering_Method = 3) with drillthrough;'

    // or DROP

    Execute (@mS) AT SEATTLESales1

    get error
    Why?

    Friday, May 29, 2009 8:09 AM
  • modify

    example:
            IF  EXISTS (SELECT srv.name FROM sys.servers srv WHERE srv.server_id != 0 AND srv.name = N'LINKSERVER1')
            EXEC master.dbo.sp_dropserver @server=N'LINKSERVER1', @droplogins='droplogins'
            EXEC master.dbo.sp_addlinkedserver @server = N'LINKSERVER1', @srvproduct=N'LINKSERVER1', @provider=N'SQLOLEDB', @datasrc=@Datasrc
            EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname = N'LINKSERVER1', @locallogin = NULL , @useself = N'False', @rmtuser = @User, @rmtpassword = @Password
            EXEC master.dbo.sp_serveroption @server=N'LINKSERVER1', @optname=N'rpc out', @optvalue=N'true'

    ......................
    Execute (@mS) AT LINKSERVER1
    吳熹
    Monday, June 1, 2009 3:43 AM
  •         EXEC master.dbo.sp_addlinkedserver @server = N'LINKSERVER1', @srvproduct=N'LINKSERVER1', @provider=N'SQLOLEDB', @datasrc=@Datasrc
    But  must be @provider=N'MSOLAP' !!!

    It's SSAS!!!

    And not work with SQL-comand with the connection.

    Why?
    Thursday, June 4, 2009 5:33 AM