* This function takes on three arguments. The first two arguments are */
/* two strings that you are combining and the third is any character that you */
/* want to put in between them. */
/* Example: funcAppend2('Hello','RAJ', '+') = Hello+RAJ */
CREATE FUNCTION dbo.funcAppend2(@String1 varchar(2000),@String2 as varchar(2000), @Spacer as varchar(5)) RETURNS varchar(2000)
AS BEGIN
Declare @Result as varchar(2000)
if @String1 is null begin
Set @Result = @Spacer + @String2
End
Else Begin
if @String2 is null begin
Set @Result = @String1
End
Else Begin
Set @Result = (@String1 + @Spacer + @String2)
End
End
Return @Result
End
No comments:
Post a Comment