Se podra convertir a store procedure de SQLserver esta rutina..?

23/10/2006 - 19:59 por Rafael Patiño Ortega | Informe spam
Se podra convertir de VB a store procedure esta rutina..?

TransferObjectsTask Object
The TransferObjectsTask object allows you transfer one or more Microsoft®
SQL Server™ objects between source and destination databases. An object can
represent:
A table, or table data.
A view.
A referential integrity constraint.
A stored procedure.
An index.
A default or a rule.
A user-defined data type.
In addition, you can transfer all users or all logins (roles) for the source
database. You can also transfer all objects dependent on the requested
objects.
Note The source and destination must both be Microsoft SQL Server version
7.0 or later databases.

*******************************************
The Microsoft Visual Basic® Sub RunTransfer creates a DTS step and a
TransferObjectsTask object. It configures the task to copy the tables authors
and employee, the view titleview, and the stored procedure byroyalty, and all
objects dependent on these, from the pubs database supplied with SQL Server
2000 to a database named SomeOfPubs.

Private Sub RunTransfer(ByVal objPackage As DTS.Package2)
Dim objStep As DTS.Step
Dim objTask As DTS.Task
Dim objXferObj As DTS.TransferObjectsTask

'create step and task
Set objStep = objPackage.Steps.New
Set objTask = objPackage.Tasks.New("DTSTransferObjectsTask")
Set objXferObj = objTask.CustomTask

'configure transfer objects task
With objXferObj
.Name = "XferObjTask"
.SourceServer = "(local)"
.SourceUseTrustedConnection = True
.SourceDatabase = "pubs"
.DestinationServer = "(local)"
.DestinationUseTrustedConnection = True
.DestinationDatabase = "SomeOfPubs"
.ScriptFileDirectory = "D:\DTS_UE\Scripts"
.CopyAllObjects = False
.IncludeDependencies = True
.IncludeLogins = False
.IncludeUsers = False
.DropDestinationObjectsFirst = True
.CopySchema = True
.CopyData = DTSTransfer_AppendData
.AddObjectForTransfer "authors", "dbo", DTSSQLObj_UserTable
.AddObjectForTransfer "employee", "dbo", DTSSQLObj_UserTable
.AddObjectForTransfer "titleview", "dbo", DTSSQLObj_View
.AddObjectForTransfer "byroyalty", "dbo", DTSSQLObj_StoredProcedure
End With

'link step to task
objStep.TaskName = objXferObj.Name
objStep.Name = "XferObjStep"
objPackage.Steps.Add objStep
objPackage.Tasks.Add objTask

Ojala que si, porque es exactamente lo que estoy buscando pero en un store
procedure.

Si alguien sabe como, por favor digamelo, se lo voy a agradecer muchisimo.

Saludos.-

Rafael Patiño Ortega
 

Leer las respuestas

#1 Alejandro Mesa
23/10/2006 - 20:46 | Informe spam
Rafael,

Puedes crear el paquete DTS en el servidor, crear un trabajo o tarea para
ejecutar ese paquete y crear un procedmiento que arranque esa tarea.


AMB

"Rafael Patiño Ortega" wrote:

Se podra convertir de VB a store procedure esta rutina..?

TransferObjectsTask Object
The TransferObjectsTask object allows you transfer one or more Microsoft®
SQL Server™ objects between source and destination databases. An object can
represent:
A table, or table data.
A view.
A referential integrity constraint.
A stored procedure.
An index.
A default or a rule.
A user-defined data type.
In addition, you can transfer all users or all logins (roles) for the source
database. You can also transfer all objects dependent on the requested
objects.
Note The source and destination must both be Microsoft SQL Server version
7.0 or later databases.

*******************************************
The Microsoft Visual Basic® Sub RunTransfer creates a DTS step and a
TransferObjectsTask object. It configures the task to copy the tables authors
and employee, the view titleview, and the stored procedure byroyalty, and all
objects dependent on these, from the pubs database supplied with SQL Server
2000 to a database named SomeOfPubs.

Private Sub RunTransfer(ByVal objPackage As DTS.Package2)
Dim objStep As DTS.Step
Dim objTask As DTS.Task
Dim objXferObj As DTS.TransferObjectsTask

'create step and task
Set objStep = objPackage.Steps.New
Set objTask = objPackage.Tasks.New("DTSTransferObjectsTask")
Set objXferObj = objTask.CustomTask

'configure transfer objects task
With objXferObj
.Name = "XferObjTask"
.SourceServer = "(local)"
.SourceUseTrustedConnection = True
.SourceDatabase = "pubs"
.DestinationServer = "(local)"
.DestinationUseTrustedConnection = True
.DestinationDatabase = "SomeOfPubs"
.ScriptFileDirectory = "D:\DTS_UE\Scripts"
.CopyAllObjects = False
.IncludeDependencies = True
.IncludeLogins = False
.IncludeUsers = False
.DropDestinationObjectsFirst = True
.CopySchema = True
.CopyData = DTSTransfer_AppendData
.AddObjectForTransfer "authors", "dbo", DTSSQLObj_UserTable
.AddObjectForTransfer "employee", "dbo", DTSSQLObj_UserTable
.AddObjectForTransfer "titleview", "dbo", DTSSQLObj_View
.AddObjectForTransfer "byroyalty", "dbo", DTSSQLObj_StoredProcedure
End With

'link step to task
objStep.TaskName = objXferObj.Name
objStep.Name = "XferObjStep"
objPackage.Steps.Add objStep
objPackage.Tasks.Add objTask

Ojala que si, porque es exactamente lo que estoy buscando pero en un store
procedure.

Si alguien sabe como, por favor digamelo, se lo voy a agradecer muchisimo.

Saludos.-

Rafael Patiño Ortega

Preguntas similares