Welcome to Sign in | Help

Re: cum creez un folder in T-SQL (SQLServer 2000)

  •  06-21-2007, 11:34 PM

    Re: cum creez un folder in T-SQL (SQLServer 2000)

    Nu, nu este simplu insa este mai sigur si ai la dispozitie instrumentar de sistem de operare Windows

    pentru operatiunile de add device / backup se foloseste "Execute SQL Task"
    iar pentru verificari/creari foldere , lansare rar, ActiveX Script Task in care se poate baga WMI

    Iata ce se poate scrie intr-un script VBScript

    ' Initialize variables.
    Dim cn As New ADODB.Connection

    Dim ServerName As String, DatabaseName As String, _
       UserName As String, Password As String

    ' Put text box values into connection variables.
    ServerName = "(local)"
    DatabaseName = "Northwind"
    UserName = sa
    Password = ""

    ' Specify the OLE DB provider.
    cn.Provider = "sqloledb"

    ' Set SQLOLEDB connection properties.
    cn.Properties("Data Source").Value = ServerName
    cn.Properties("Initial Catalog").Value = DatabaseName

    ' Decision code for login authorization type:
    ' Windows NT or SQL Server authentication.
    'If optWinNTAuth.Value = True Then
        cn.Properties("Integrated Security").Value = "SSPI"
    'Else
     '   cn.Properties("User ID").Value = UserName
     '   cn.Properties("Password").Value = Password
    'End If

    ' Open the database.
    cn.Open

    Dim cmd As New ADODB.Command
    Dim rs As New ADODB.Recordset

    'cn.Open "Provider=sqloledb;Data Source=MyServerName;" & _
    '   "Initial Catalog=northwind;User Id=sa;Password=;"

    'Prepare the user-defined function statement and execute the command.
    cmd.ActiveConnection = cn
    cmd.CommandText = "select * from region"
    Set rs = cmd.Execute
    MsgBox rs!RegionDescription
    rs.Close

    cn.Close
     

    dupa ce se face package-ul cu taskurile respective se pune intr-un job comanda urmatoare

    dtsrun /Sserver_name /Uuser_nName /Ppassword /Npackage_name /Mpackage_password

    Exista o baza de date de scripturi specifice prin care se poate monitoriza tot

    http://www.microsoft.com/technet/scriptcenter/scripts/default.mspx?mfr=true

    (ar fi o sursa de inspiratie pt scripturile ce ar trebui bagate in taskul ActiveX)


    Gheorghe Ciubuc,SQL Server Influencer, MCP(SQL 2000), MCTS (SQL Server 2005) , OCA(Oracle 9i), Sybase(Brainbench)
View Complete Thread
Powered by Community Server (Commercial Edition), by Telligent Systems