dbaspot
Tags Register FAQ Calendar Search Today's Posts Mark Forums Read

Transfer SQL Server Objects Task not working with Stored Procedures - sqlserver-dts

This is a discussion on Transfer SQL Server Objects Task not working with Stored Procedures - sqlserver-dts ; I'm unable to copy my Stored Procedures from one database to another. I'm using mixed mode authentication. I have set CopyAllStoredProcedures to True, DropObjectsFirst to True and CopySchema to True. Nothing gets copied. I have followed many web sites that ...


Home > Database Forum > Microsoft SQL Server > sqlserver-dts > Transfer SQL Server Objects Task not working with Stored Procedures

Reply

 

LinkBack Thread Tools Display Modes
  #1  
Old 09-17-2007, 01:48 PM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Transfer SQL Server Objects Task not working with Stored Procedures

I'm unable to copy my Stored Procedures from one database to another.
I'm using mixed mode authentication. I have set
CopyAllStoredProcedures to True, DropObjectsFirst to True and
CopySchema to True.



Nothing gets copied. I have followed many web sites that say Transfer
SQL Server Objects Task is broken. Is this true and I should give up?



Also, I'm on SQL 2005 SP2 which appears to be the latest and I assume
is the update for SSIS? yes ?



Thanks for any help



[Transfer SQL Server Objects Task] Error: Execution failed with the
following error: "ERROR : errorCode=-1073548784 description=Executing
the query "CREATE PROCEDURE [dbo].
[del_Admin_RemoveContractorFromContract] @ContractID int,
@ContractorID int AS DELETE FROM CONTRACTOR_CONTRACTS WHERE
CONTRACT_ID = @ContractID AND CONTRACTOR_ID = @ContractorID DELETE
FROM CONTRACTOR_USER_CONTRACTS WHERE CONTRACT_ID = @ContractID AND
CONTRACTOR_ID = @ContractorID " failed with the following error:
"There is already an object named
'del_Admin_RemoveContractorFromContract' in the database.". Possible
failure reasons: Problems with the query, "ResultSet" property not set
correctly, parameters not set correctly, or connection not established
correctly. helpFile= helpContext=0 idofInterfaceWithError={8BDFE893-
E9D8-4D23-9739-DA807BCDC2AC}".



Warning: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The
Execution method succeeded, but the number of errors raised (1)
reached the maximum allowed (1); resulting in failure. This occurs
when the number of errors reaches the number specified in
MaximumErrorCount. Change the MaximumErrorCount or fix the errors.

Reply With Quote
  #2  
Old 09-17-2007, 10:45 PM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: Transfer SQL Server Objects Task not working with Stored Procedures

On Sep 17, 12:48 pm, "bringmewa...@gmail.com"
wrote:
> I'm unable to copy my Stored Procedures from one database to another.
> I'm using mixed mode authentication. I have set
> CopyAllStoredProcedures to True, DropObjectsFirst to True and
> CopySchema to True.
>
> Nothing gets copied. I have followed many web sites that say Transfer
> SQL Server Objects Task is broken. Is this true and I should give up?
>
> Also, I'm on SQL 2005 SP2 which appears to be the latest and I assume
> is the update for SSIS? yes ?
>
> Thanks for any help
>
> [Transfer SQL Server Objects Task] Error: Execution failed with the
> following error: "ERROR : errorCode=-1073548784 description=Executing
> the query "CREATE PROCEDURE [dbo].
> [del_Admin_RemoveContractorFromContract] @ContractID int,
> @ContractorID int AS DELETE FROM CONTRACTOR_CONTRACTS WHERE
> CONTRACT_ID = @ContractID AND CONTRACTOR_ID = @ContractorID DELETE
> FROM CONTRACTOR_USER_CONTRACTS WHERE CONTRACT_ID = @ContractID AND
> CONTRACTOR_ID = @ContractorID " failed with the following error:
> "There is already an object named
> 'del_Admin_RemoveContractorFromContract' in the database.". Possible
> failure reasons: Problems with the query, "ResultSet" property not set
> correctly, parameters not set correctly, or connection not established
> correctly. helpFile= helpContext=0 idofInterfaceWithError={8BDFE893-
> E9D8-4D23-9739-DA807BCDC2AC}".
>
> Warning: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The
> Execution method succeeded, but the number of errors raised (1)
> reached the maximum allowed (1); resulting in failure. This occurs
> when the number of errors reaches the number specified in
> MaximumErrorCount. Change the MaximumErrorCount or fix the errors.



My preferred way of transferring stored procedures is to open SSMS/
Mgmt Studio and select Programming -> Stored Procedures and open the
Object Detail Browser. Then drag your mouse over all the non-system
stored procedures and right-click and then select 'script as Drop' and
'script as Create.' And execute the resulting scripts in the other
database. Hope this helps.

Regards,

Enrique Martinez
Sr. Software Consultant

Reply With Quote
  #3  
Old 09-18-2007, 07:55 AM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: Transfer SQL Server Objects Task not working with Stored Procedures

But I need these to run on a schedule. Is SSIS a piece of crap or can
it do these basic tasks?

On Sep 17, 10:45 pm, EMartinez wrote:
> On Sep 17, 12:48 pm, "bringmewa...@gmail.com"
> wrote:
>
>
>
> > I'm unable to copy my Stored Procedures from one database to another.
> > I'm using mixed mode authentication. I have set
> > CopyAllStoredProcedures to True, DropObjectsFirst to True and
> > CopySchema to True.

>
> > Nothing gets copied. I have followed many web sites that say Transfer
> > SQL Server Objects Task is broken. Is this true and I should give up?

>
> > Also, I'm on SQL 2005 SP2 which appears to be the latest and I assume
> > is the update for SSIS? yes ?

>
> > Thanks for any help

>
> > [Transfer SQL Server Objects Task] Error: Execution failed with the
> > following error: "ERROR : errorCode=-1073548784 description=Executing
> > the query "CREATE PROCEDURE [dbo].
> > [del_Admin_RemoveContractorFromContract] @ContractID int,
> > @ContractorID int AS DELETE FROM CONTRACTOR_CONTRACTS WHERE
> > CONTRACT_ID = @ContractID AND CONTRACTOR_ID = @ContractorID DELETE
> > FROM CONTRACTOR_USER_CONTRACTS WHERE CONTRACT_ID = @ContractID AND
> > CONTRACTOR_ID = @ContractorID " failed with the following error:
> > "There is already an object named
> > 'del_Admin_RemoveContractorFromContract' in the database.". Possible
> > failure reasons: Problems with the query, "ResultSet" property not set
> > correctly, parameters not set correctly, or connection not established
> > correctly. helpFile= helpContext=0 idofInterfaceWithError={8BDFE893-
> > E9D8-4D23-9739-DA807BCDC2AC}".

>
> > Warning: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The
> > Execution method succeeded, but the number of errors raised (1)
> > reached the maximum allowed (1); resulting in failure. This occurs
> > when the number of errors reaches the number specified in
> > MaximumErrorCount. Change the MaximumErrorCount or fix the errors.

>
> My preferred way of transferring stored procedures is to open SSMS/
> Mgmt Studio and select Programming -> Stored Procedures and open the
> Object Detail Browser. Then drag your mouse over all the non-system
> stored procedures and right-click and then select 'script as Drop' and
> 'script as Create.' And execute the resulting scripts in the other
> database. Hope this helps.
>
> Regards,
>
> Enrique Martinez
> Sr. Software Consultant



Reply With Quote
  #4  
Old 12-15-2008, 11:37 AM
Database Newbie
 
Join Date: Dec 2008
Posts: 1
bpeterson is on a distinguished road
Default Re: Transfer SQL Server Objects Task not working with Stored Procedures

I was finally able to transfer an sp in .NET script task by overriding the defaults and explicitly setting many of the options. Hope this helps others, as I struggled with it for a couple days.

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.SqlServer.Management.Smo
Imports Microsoft.SqlServer.Management.Common
Imports System.Collections.Specialized
Imports System.Collections.Generic

Public Class ScriptMain

Public Sub Main()

Dim SourceConnection As Microsoft.SqlServer.Dts.Runtime.ConnectionManager
Dim SourceServer As Server
Dim SourceDB As Database

Dim DestinationConnection As Microsoft.SqlServer.Dts.Runtime.ConnectionManager
Dim DestinationServer As Server
Dim DestinationDB As Database

SourceConnection = Dts.Connections("DB_OLEDB")
SourceServer = New Server(CStr(Dts.Connections("DB_OLEDB").Properties("ServerName").GetValue(SourceConnection)))
SourceDB = SourceServer.Databases(CStr(Dts.Connections("DB_OLEDB").Properties("InitialCatalog").GetValue(SourceConnection)))

DestinationConnection = Dts.Connections("Reporting_OLEDB")
DestinationServer = New Server(CStr(Dts.Connections("Reporting_OLEDB").Properties("ServerName").GetValue(DestinationConnection)))
DestinationDB = DestinationServer.Databases(CStr(Dts.Connections("Reporting_OLEDB").Properties("InitialCatalog").GetValue(DestinationConnection)))


Dim SMOTransfer As Transfer
SMOTransfer = New Transfer(SourceDB)

SMOTransfer.CopyData = False
SMOTransfer.CopySchema = True
SMOTransfer.CopyAllObjects = False
SMOTransfer.CopyAllTables = False
SMOTransfer.Options.WithDependencies = False
SMOTransfer.DropDestinationObjectsFirst = True
SMOTransfer.CopyAllUsers = False
SMOTransfer.CopyAllRoles = False
SMOTransfer.CopyAllLogins = False
SMOTransfer.Options.Permissions = False
SMOTransfer.Options.Indexes = False
SMOTransfer.CopyAllDatabaseTriggers = False
SMOTransfer.CopyAllStoredProcedures = False
SMOTransfer.CopyAllUserDefinedFunctions = False
SMOTransfer.CopyAllViews = False

SMOTransfer.DestinationServer = DestinationServer.Name
SMOTransfer.DestinationDatabase = DestinationDB.Name
SMOTransfer.Options.IncludeIfNotExists = True
SMOTransfer.Options.ContinueScriptingOnError = True
SMOTransfer.Options.ExtendedProperties = False

'MsgBox("ObjectType: " + Dts.Variables("ObjectType").Value().ToString())

If Dts.Variables("ObjectType").Value().ToString() = "P " Then
'MsgBox("CopyObject: " + CStr(Dts.Variables("CopyObject").Value) + " " + CStr(Dts.Variables("ObjectType").Value) + "-" + CStr(Dts.Variables("ObjectSourceID").Value))
SMOTransfer.ObjectList.Add(SourceDB.StoredProcedur es(Dts.Variables("CopyObject").Value().ToString()))
SMOTransfer.TransferData()
ElseIf Dts.Variables("ObjectType").Value().ToString() = "X " Then
SMOTransfer.ObjectList.Add(SourceDB.ExtendedStored Procedures(Dts.Variables("CopyObject").Value().ToString()))
SMOTransfer.TransferData()
ElseIf Dts.Variables("ObjectType").Value().ToString() = "V " Then
SMOTransfer.ObjectList.Add(SourceDB.Views(Dts.Vari ables("CopyObject").Value().ToString()))
SMOTransfer.TransferData()
ElseIf Dts.Variables("ObjectType").Value().ToString() = "FN" Or Dts.Variables("ObjectType").Value().ToString() = "TF" Or Dts.Variables("ObjectType").Value().ToString() = "IF" Then
SMOTransfer.ObjectList.Add(SourceDB.UserDefinedFun ctions(Dts.Variables("CopyObject").Value().ToString()))
SMOTransfer.TransferData()
End If


Dts.TaskResult = Dts.Results.Success
End Sub

End Class
Reply With Quote
Reply

Thread Tools
Display Modes



All times are GMT -4. The time now is 08:15 PM.