Wednesday, March 28, 2012

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
thanksHuh? 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:create function [dbo].[CleanText](@.TextString varchar(max))
returns varchar(max)
as
begin
return replace(@.TextString, char(14), '')
end|||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|||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.|||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|||Thank You Execute Is The Key|||...or just hit F5.

No comments:

Post a Comment