Application.SaveToSqlServerAs(Package, IDTSEvents, String, String, String, String) Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Salva un pacchetto in un'istanza di SQL Server con un nuovo nome.
public:
void SaveToSqlServerAs(Microsoft::SqlServer::Dts::Runtime::Package ^ package, Microsoft::SqlServer::Dts::Runtime::IDTSEvents ^ events, System::String ^ packagePath, System::String ^ serverName, System::String ^ serverUserName, System::String ^ serverPassword);
public void SaveToSqlServerAs (Microsoft.SqlServer.Dts.Runtime.Package package, Microsoft.SqlServer.Dts.Runtime.IDTSEvents events, string packagePath, string serverName, string serverUserName, string serverPassword);
member this.SaveToSqlServerAs : Microsoft.SqlServer.Dts.Runtime.Package * Microsoft.SqlServer.Dts.Runtime.IDTSEvents * string * string * string * string -> unit
Public Sub SaveToSqlServerAs (package As Package, events As IDTSEvents, packagePath As String, serverName As String, serverUserName As String, serverPassword As String)
Parametri
- package
- Package
Pacchetto da salvare.
- events
- IDTSEvents
Oggetto IDTSEvents.
- packagePath
- String
Percorso e nuovo nome da assegnare al pacchetto. Il parametro packagePath è nel formato \ cartella \ PackageName. Se packagePath viene specificato senza una cartella esistente, il pacchetto verrà salvato utilizzando questo parametro come nuovo nome.
- serverName
- String
Nome dell'istanza di SQL Server.
- serverUserName
- String
Nome dell'account utilizzato per accedere all'istanza di SQL Server.
- serverPassword
- String
Password dell'account utente.
Esempio
Nell'esempio di codice seguente il pacchetto di esempio denominato ExecuteProcess. dtsx viene salvato nella cartella msdb con un nuovo nome myNewPackage. Per verificare che il pacchetto sia stato salvato, eseguire la query Transact-SQL seguente sul database msdb . La query restituisce tutti i pacchetti archiviati nella tabella di sistema msdb .
select * from sysssispackages
In alternativa, connettersi al servizio Integration Services, espandere pacchetti archiviati, quindi espandere msdb. Verrà elencato il pacchetto con il nome specificato in packagePath .
static void Main(string[] args)
{
// The variable pkg points to the location
// of the ExecuteProcess package sample
// that is installed with the SSIS samples.
string pkg = @"C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx";
Application app = new Application();
Package p = app.LoadPackage(pkg, null);
// Save the package to the SQL Server msdb folder, which is
// also the MSDB folder in the Integration Services service, or as a row in the
//sysssispackages table.
app.SaveToSqlServerAs(p, null, "myNewPackage", "yourserver", null, null);
}
Shared Sub Main(ByVal args() As String)
' The variable pkg points to the location
' of the ExecuteProcess package sample
' that is installed with the SSIS samples.
Dim pkg As String = "C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx"
Dim app As Application = New Application()
Dim p As Package = app.LoadPackage(pkg,Nothing)
' Save the package to the SQL Server msdb folder, which is
' also the MSDB folder in the Integration Services service, or as a row in the
'sysssispackages table.
app.SaveToSqlServerAs(p, Nothing, "myNewPackage", "yourserver", Nothing, Nothing)
End Sub