SQLTeam.com | Weblogs | Forums

Table function


#1

Not sure if this is possible I want a function that will remove certain words. I need to do it through a function as these words can be over several tables and writing it once is a great plan. At current I have 6 words these can appear any where in 1 column. Any help will be appreciated.


#2

Your function would look like:

create function remove_certain_words(@input varchar(8000))
returns varchar(8000)
as
begin

declare @output varchar(8000);
set @output = (insert your code to do the work);
return @output;
end;
go


#3

Do you want to also prevent it from occurring? If so, I'd use a check constraint and then handle the exception in the application layer.


#4

Thanks this works a treat.