Page 1 of 1

Create Foldblock for T-SQL

Posted: 21 Apr 2009 11:03
by taucher1
Hi all,
how can I create a Fold for T-SQL Script like this:


if @i != 0
begin

set @state = 'ALBERTA'

Set @new_state = case @state
when 'ALBERTA' then 'AB'
else 'n/a'
end -- case
set @country ='CANADA'
end -- if

I've following Folding ID's

FoldID if
FOLD_BEGIN begin
FOLD_END end


FoldID case
FOLD_BEGIN case
FOLD_END end

The end for the if-statement will not be recognize in this case.
I hope anyone can help me.

Thanks
Ronald

Posted: 21 Apr 2009 21:07
by Rickard Johansson
Try to set the fold option for "case" to

FoldID=case
FOLD_BEGIN=
FOLD_END=end

Posted: 22 Apr 2009 12:32
by taucher1
:(
No, it will not work.

Ronald

Posted: 25 Apr 2009 18:26
by Rickard Johansson
I just tried to add this to the SQL syntax:

[Fold]
1_Id=if
1_Begin=begin
1_End=end
1_EndBefore=
1_Section=
1_NoParentOfId=0
1_ListItem=
2_Id=case
2_Begin=
2_End=end
2_EndBefore=
2_Section=
2_NoParentOfId=0
2_ListItem=

I used the syntax editor and RJ TextEd v5.01.

The code

if @i != 0
begin

set @state = 'ALBERTA'

Set @new_state = case @state
when 'ALBERTA' then 'AB'
else 'n/a'
end -- case
set @country ='CANADA'
end -- if

folds just fine. Both the case and if statements are folded properly.

Posted: 04 May 2009 12:03
by taucher1
Hi Richard,
sorry for late answer.

I've got this fold (It tooks the first case --end and not the end --if)

if @i != 0 ...
set @country ='CANADA'
end -- if


and not

if @i != 0 ...

Syntax:

PostPosted: Sat Apr 25, 2009 5:26 pm Post subject:
I just tried to add this to the SQL syntax:

[Fold]
1_Id=if
1_Begin=begin
1_End=end
1_EndBefore=
1_Section=
1_NoParentOfId=0
1_ListItem=
2_Id=case
2_Begin=
2_End=end
2_EndBefore=
2_Section=
2_NoParentOfId=0
2_ListItem=

with RJ TextEd v5.01

Posted: 08 May 2009 13:56
by taucher1
Hi,
in v5.10 it will work correctly :)

Posted: 08 May 2009 13:59
by Rickard Johansson
I guess I made a small change somewhere in the folding code, but I can't remember where right now... I'm glad it works now :D