FIX: Transfer of a View that Contains a UDF by Using DTS Export Data Fails with Error 208

Article translations Article translations
Article ID: 300272 - View products that this article applies to.
This article was previously published under Q300272
BUG #: 352081 (SHILOH_BUGS)
Expand all | Collapse all

On This Page

SYMPTOMS

Attempts to transfer a view by using the Data Transformation Service (DTS) Import/Export wizard fails under the following conditions:
  • The view includes a user-defined function (UDF).
  • When copying objects and data between SQL Server databases.
The following text is an example of the error message that displays:
Failed to copy objects from Microsoft SQL Server to Microsoft SQL Server
[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'dbo.TestFunc'.
NOTE: "dbo.TestFunc" is the name of the UDF.

CAUSE

The view is being created in the destination database before the UDF, which is the dependent object. All the dependent objects must be created first.

RESOLUTION

To resolve this problem, obtain the latest service pack for SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
290211 INF: How to Obtain the Latest SQL Server 2000 Service Pack

WORKAROUND

Transfer all the objects that the view depends on first, and then when you transfer the view, do not include dependent objects.

STATUS

Microsoft has confirmed that this is a problem in SQL Server 2000. This problem was first corrected in SQL Server 2000 Service Pack 1.

MORE INFORMATION

Steps to Reproduce Behavior

  1. In the source database, run this code to create the table, view and UDF:
    CREATE FUNCTION TestFunc ()
    RETURNS INT AS  
    BEGIN 
    	RETURN 15
    END
    go
    
    CREATE TABLE dbo.TestTable ( col1 int NULL )
    go
    
    CREATE VIEW dbo.TestView
    AS
    SELECT col1, dbo.TestFunc() AS FuncResults FROM dbo.TestTable
    go
    					
  2. Now, use the DTS Export/Import wizard to copy these to another SQL Server database.
  3. Select the Copy objects and data between SQL Server databases option. Leave all the scripting options at their default settings. This fails with the following error message in the .log file for the target database:
    Transfer Status: Creating Views on destination database
    [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'dbo.TestFunc'.
To workaround this problem, copy the dependent table, TestTable, and the "TestFunc" UDF across first. Then copy the view with the Include all dependent objects option cleared.

Properties

Article ID: 300272 - Last Review: November 5, 2003 - Revision: 3.2
APPLIES TO
  • Microsoft SQL Server 2000 Standard Edition
Keywords: 
kbbug kbfix kbsqlserv2000sp1fix KB300272

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com