Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 14th, 2005, 11:55 AM
ea ea is offline
Registered User
 
Join Date: Nov 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default UDF: allowed in one DB but not another???

Can someone help on this.

I've got a UDF Scalar Function that works fine in on database, but when I try to copy the same UDF to another database I get syntax error messages.

The function is:
ALTER FUNCTION dbo.GetDateFilled
    (
    @dateAt1 datetime,
    @dateAt2 datetime,
        @dateEndActual datetime
        )
RETURNS datetime
AS
    BEGIN
    Declare @dateFilled datetime
    If @dateAt1 Is Not Null And @dateAt2 Is Null
        set @dateFilled = @dateAt1
    Else
        If @dateAt1 Is Null And @dateAt2 Is Not Null
        set @dateFilled = @dateAt2
    Else
        If @dateAt1 Is Null And @dateAt2 Is Null
        set @dateFilled = @dateEndActual
    Else
            Set @dateFilled = @dateAt1
    RETURN @dateFilled
    END

And this isn't the only UDF I can't import from one DB to another. It seems that I can't import any???

Any ideas would be greatly appreciated:

ea


 
Old January 16th, 2005, 04:05 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default

What is your syntax error message. Is the owner of the function the same owner on both databases.



Jaime E. Maccou
 
Old January 18th, 2005, 03:14 PM
ea ea is offline
Registered User
 
Join Date: Nov 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What I did was try to import the function through an Access ADP. So the function owner should be the same.

Any other ideas on this? I'm really stumpted and I owe this to a client.

Otherwise, would you have a work-around?

Thanks,
ea







Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF references DavidReese BOOK: Excel 2007 VBA Programmer's Reference ISBN: 978-0-470-04643-2 0 November 2nd, 2008 11:04 AM
trying to run an udf miguel.ossa SQL Server 2005 7 July 22nd, 2007 11:12 AM
how can i execute SQL in UDF vinod_mnr SQL Server 2000 1 March 18th, 2005 12:51 PM
Returning a result from a db function not allowed? treycarroll Beginning PHP 2 March 17th, 2004 07:53 PM
UDF and Stored Procedures hrishimusale SQL Server 2000 1 November 4th, 2003 12:07 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.