Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2003
    Location
    FRANCE
    Posts
    393

    Unanswered: Scripts of databases

    I'm generating a script of my database
    but when I reapply it
    it doesn't work 'cause there's no hierachization (???)
    of the functions


    for example I've got 2 functions

    F1 that uses F2
    F2


    but the script creates F1 before F2
    so it generates an error

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322

    Re: Scripts of databases

    Originally posted by Karolyn
    no hierachization (???)

    No Order of Dependencies....

    Yup...

    Hope Yukon Addresses that...

    But I thought that was only for Tables and RI


    Gotta test it....
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Code:
    USE Northwind
    GO
    
    CREATE FUNCTION udf_1 (@x int) RETURNS int 
    AS 
    BEGIN
    DECLARE @y int
    	SELECT @y = dbo.udf_2(@x)
    RETURN @y
    END
    GO
    
    CREATE FUNCTION udf_2 (@x int) RETURNS int 
    AS 
    BEGIN
    DECLARE @y int
    	SELECT @y = @x/2
    RETURN @y
    END
    GO
    
    SELECT dbo.udf_1(10)
    GO
    
    DROP FUNCTION udf_1
    DROP FUNCTION udf_2
    GO
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  4. #4
    Join Date
    Nov 2003
    Location
    FRANCE
    Posts
    393
    just told this to my collegue, thanks
    but I should have tested this before

  5. #5
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Originally posted by Karolyn
    just told this to my collegue, thanks
    but I should have tested this before
    Always test.....isn't it like 7:30 your time?

    Man I'm in to my 3rd cocktail by then....

    .
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •