Sure. Here is an short snippet

Before

CREATE FUNCTION Inffkfrom(@tbID  INT,  @colID SMALLINT)  returns 
VARCHAR(2000)  AS 
BEGIN 
DECLARE @r VARCHAR(2000), @a VARCHAR(200) 

SELECT @r = '', @a = '' 

DECLARE cs CURSOR FOR  SELECT FKfrom=CONVERT(VARCHAR(200), 
Object_name(rkeyid)+'.'+r.[name])  FROM   sysforeignkeys c JOIN syscolumns 
f  ON c.fkeyid = f.[id]  AND c.fkey = f.colID  JOIN syscolumns r ON 
c.rkeyid = r.[id] AND c.rkey = r.colID WHERE  fkeyID = @tbID AND fkey = 
@colID  ORDER  BY  keyNo 

OPEN cs 

FETCH NEXT FROM cs INTO @a 

WHILE @@FETCH_STATUS = 0 
BEGIN 
SELECT @r = @r + CASE 
WHEN Len(@r) > 0 THEN ', ' 
ELSE '' 
END + @a 

FETCH NEXT FROM cs INTO @a 
END 

CLOSE cs 

DEALLOCATE cs 

RETURN( @r ) 
END 

GO 

CREATE FUNCTION *Inffkfrom*(@tbID  *INT*, 
                          @colID *SMALLINT*) 
returns *VARCHAR*(2000) 
AS 
  BEGIN 
      DECLARE @r *VARCHAR*(2000), 
              @a *VARCHAR*(200) 

      SELECT @r = '', 
             @a = '' 

      DECLARE cs CURSOR FOR 
        SELECT FKfrom=*CONVERT*(*VARCHAR*(200), *Object_name*(rkeyid)+'.'+r.
[name]) 
        FROM   sysforeignkeys c 
               JOIN syscolumns f 
                 ON c.fkeyid = f.[id] 
                    AND c.fkey = f.colID 
               JOIN syscolumns r 
                 ON c.rkeyid = r.[id] 
                    AND c.rkey = r.colID 
        WHERE  fkeyID = @tbID 
               AND fkey = @colID 
        ORDER  BY 
          keyNo 

      OPEN cs 

      FETCH NEXT FROM cs INTO @a 

      WHILE *@@FETCH_STATUS* = 0 
        BEGIN 
            SELECT @r = @r + CASE 
                               WHEN *Len*(@r) > 0 THEN ', ' 
                               ELSE '' 
                             END + @a 

            FETCH NEXT FROM cs INTO @a 
        END 

      CLOSE cs 

      DEALLOCATE cs 

      RETURN( @r ) 
  END 

GO 


On Thursday, February 25, 2016 at 12:49:50 PM UTC-8, [email protected] 
wrote:
>
> I think we need more specifics to be able to provide an answer. Can you 
> provide an example of the code you are trying to clean up and what it might 
> look like after formatting?
>
> [fletcher]
>
>
> On Feb 25, 2016, at 12:04 PM, Sunny997 <[email protected] <javascript:>> 
> wrote:
>
> Hi,
>
> Is there a text filter available which can be used to reformat PL/SQL 
> code? If not is there any guidance available on how to write this?
>
> Thanks
> Sunny
>
>
> -- 
> This is the BBEdit Talk public discussion group. If you have a 
> feature request or would like to report a problem, please email
> "[email protected] <javascript:>" rather than posting to the group.
> Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> To post to this group, send email to [email protected] <javascript:>
> .
>
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].

Reply via email to