You are currently offline, waiting for your internet to reconnect

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

This article was previously published under Q300272
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 352081 (SHILOH_BUGS)
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.
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.
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 theMicrosoft Knowledge Base:
290211 INF: How to Obtain the Latest SQL Server 2000 Service Pack
Transfer all the objects that the view depends on first, and then when you transfer the view, do not include dependent objects.
Microsoft has confirmed that this is a problem in SQL Server 2000. This problem was first corrected in SQL Server 2000 Service Pack 1.

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 15ENDgoCREATE TABLE dbo.TestTable ( col1 int NULL )goCREATE VIEW dbo.TestViewASSELECT col1, dbo.TestFunc() AS FuncResults FROM dbo.TestTablego					
  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.
208 package

Article ID: 300272 - Last Review: 01/16/2015 22:52:46 - Revision: 3.2

Microsoft SQL Server 2000 Standard Edition

  • kbnosurvey kbarchive kbbug kbfix kbsqlserv2000sp1fix KB300272