Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2003
    Posts
    68

    Unhappy Unanswered: Need Help - UDF SQL 00 to Scalar SQL 05

    I'm having trouble with the UDF's I had in SQL 2000 that were migrated to SQL 2005 under the SCALAR FUNCTION item. Before in 2000 you just created the UDF, named it and saved. IN SQL 2005 you create/modify and then have to save it as a .SQL file to a folder. First of all, what folder should it go to so that all can use and secondly, when I do this and run the functions it doesn't work... I need to modify the scalar function and
    save it with out saving to a .SQL file. How do I do this or is this the new way to create/modify functions. Any help is much appreciated
    thanks
    jm

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Huh? I don't know what you are talking about. I've created functions in 2005 using the same code as in 2000.

    Here is an example of a scalar function I created in 2005:
    Code:
    create function [dbo].[CleanText](@TextString varchar(max))
    returns varchar(max)
    as
    begin
    return replace(@TextString, char(14), '')
    end
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Aug 2003
    Posts
    68
    Understood. But how do you save them, does it ask you to save them to a .SQL file? Can you tell me the steps to modifying an existing scalar and saving...
    thx
    jm

  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    The code I gave you creates a UDF in the database. As with any code you edit in Management Studio (or the old Query Analyzer), when you exit the program it prompts you whether you want to save your code to a file. Whether you want a copy of the script on your hard drive is up to you, and has nothing to do with the operation of the database.
    To edit a function, right click on the function in Management Studio and select Modify. When you are through editing the code, run the script to execute it.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  5. #5
    Join Date
    Aug 2003
    Posts
    68
    Here is what I'm doing.

    Go to Management Studio
    Select Database Engine
    Select DB working with
    Select Programmability
    Select Functions/Scalar
    Right pane select function
    Modify function
    Tab pops up in right pane named ....SQLquery4.SQL
    Right click it asks to save I say Yes, goes to dialog asks for name
    I then close. When I open the function again, change wasn't made.
    What am I doing wrong.
    thx
    jm

  6. #6
    Join Date
    Aug 2003
    Posts
    68

    Thanks Execute Is The Key

    Thank You Execute Is The Key
    jm

  7. #7
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    ...or just hit F5.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

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