Advertisement

03.27.2008 at 07:01AM PDT, ID: 23274020
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.0

SSIS Script Transfer results in "There is already an object named" for procs & views

Asked by Russell2566 in SQL Server 2005, Microsoft Visual Basic.Net, MS SQL DTS

Tags: ,

I'm writing a simple SSIS package script [my first SSIS romp] and I'm running into a headache that won't go away. When I have CopyAllViews = true or procedures as well i get back a standard SQL error:

"There is already an object named"

When I check the destination I already have that proc/view. It's like it's trying to create each view and proc 2x. DropDestinationObjectsFirst  = true has no effect as that only seems to be run once. I've tested this on multiple DBs and run into the same results.

I'm desperately looking for a scripted solution workaround or patch to the SSIS engine. I've found lots of people with this problem, but no one with a good solution. There is no way I'm the only person trying to do this.

Is there a good VB way to transfer the views/procs separately in a NON-Transfer method?Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
Imports System
Imports System.Data
Imports System.Math
Imports System.Data.SqlClient
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.SqlServer.Management.Smo
Imports Microsoft.SqlServer.Management.Common
 
 
Public Class ScriptMain
 
    Public Sub Main()
        ' Get Source Data
        Dim SourceServerName As String = InputBox("What is your Source's Server", "Source Server?", "")
        Dim SourceDbName As String = InputBox("What is your Source's Database", "Source Database?", "")
        Dim SourceUser As String = InputBox("What is your Source's Username", "Source Username?", "")
        Dim SourcePassword As String = InputBox("What is your Source's Password", "Source Password?", "")
 
        ' Get Destination Data
        Dim DestServerName As String = InputBox("What is your Destination's Server", "Destination Server?", "")
        Dim DestDbName As String = InputBox("What is your Destination's Database", "Destination Database?", SourceDbName)
        Dim DestUser As String = InputBox("What is your Destination's Username", "Destination Username?", "")
        Dim DestPassword As String = InputBox("What is your Destination's Password", "Destination Password?", "")
 
        Dim SourceServerConn As ServerConnection = New ServerConnection(SourceServerName, SourceUser, SourcePassword)
        Dim SourceServer As Server = New Server(SourceServerConn)
        Dim SourceDb As Database = SourceServer.Databases(SourceDbName)
 
        Dim DestServerConn As ServerConnection = New ServerConnection(DestServerName, DestUser, DestPassword)
        Dim DestServer As Server = New Server(DestServerConn)
        Dim DestDb As Database = DestServer.Databases("Master")
 
        'Drop the existing DB
        Try
            Dim rs As DataSet
            Dim qry As String = "IF EXISTS (SELECT name FROM sys.databases WHERE name = N'" + DestDbName + "') " & _
                "DROP DATABASE [" + DestDbName + "] "
        Catch e As Exception
            MsgBox(e.Message)
            'Do nothing DB doesn't exist
        End Try
 
        'Recreate the target DB
        DestDb = New Database(DestServer, DestDbName)
        DestDb.Create()
 
        ' Create Transfer Object and set basic settings
        Dim xfr As Transfer = New Transfer(SourceDb)
 
        xfr.DestinationServer = DestServerName
        xfr.DestinationDatabase = DestDbName
        xfr.DestinationLogin = DestUser
        xfr.DestinationPassword = DestPassword
        xfr.DropDestinationObjectsFirst = True
 
        xfr.CopyData = True
        xfr.CopyAllObjects = False
        xfr.CopyAllDefaults = True
        xfr.CopyAllDatabaseTriggers = True
 
        xfr.CopyAllTables = True
        xfr.CopyAllUsers = False
        xfr.CopyAllViews = True
        xfr.CopyAllStoredProcedures = True
 
        xfr.Options.WithDependencies = False
        xfr.Options.ContinueScriptingOnError = True
        xfr.Options.Indexes = True
        xfr.Options.ScriptDrops = True
 
        ' Start Transfer
        xfr.TransferData()
 
        Dts.TaskResult = Dts.Results.Success
    End Sub
 
End Class
[+][-]03.27.2008 at 07:41AM PDT, ID: 21221861

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.27.2008 at 08:13AM PDT, ID: 21222262

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.27.2008 at 09:35AM PDT, ID: 21223271

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: SQL Server 2005, Microsoft Visual Basic.Net, MS SQL DTS
Tags: T-SQL, There is already an object named
Sign Up Now!
Solution Provided By: assyst
Participating Experts: 2
Solution Grade: A
 
 
[+][-]03.27.2008 at 09:45AM PDT, ID: 21223398

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.27.2008 at 09:55AM PDT, ID: 21223502

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.27.2008 at 11:07AM PDT, ID: 21224228

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.27.2008 at 11:18AM PDT, ID: 21224323

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628