Monday, March 12, 2012

Function to return "remaining" of field after it finds a character in the field.

Hi,

another problem I have is that have compounded fields in my sql table.

Example

product@.customer

I need a simple function to return "customer", so it should return the value
after "@.", unfortunate "@." will sometimes be character number 6, sometimes
character number 7 etc.

regards
JorgenSolutions was :

set ANSI_NULLS ON

set QUOTED_IDENTIFIER ON

GO

CREATE FUNCTION [sapserviceaccount].[UNTRUNK2] (@.inp as varchar(100))

RETURNS varchar(20) AS

BEGIN

declare @.out varchar(20);

if LEN(@.inp) 0

begin

set @.out = right( @.INP, (LEN(@.INP)-CHARINDEX('@.', @.INP)))

end

else

begin

set @.out = @.inp;

end

return @.out

END

"Jorgen [DK/2600]" <nyhedsgruppe_hejhej_@.gmail.comwrote in message
news:45daf1e7$0$90272$14726298@.news.sunsite.dk...

Quote:

Originally Posted by

Hi,
>
another problem I have is that have compounded fields in my sql table.
>
Example
>
product@.customer
>
I need a simple function to return "customer", so it should return the
value
after "@.", unfortunate "@." will sometimes be character number 6, sometimes
character number 7 etc.
>
regards
Jorgen
>
>
>

No comments:

Post a Comment