Comments
1 comment
-
Hi Dean,
Thanks for your feedback, as you point out the main problem we have with the Lay Out feature is that what is good layout and what isn't is very subjective.
That being said:
1)dvitner wrote:Further on, in the fetch statement, there should be a space after commas between the variables:
Ifetch next from tb into
@nazwa, @id, @id_woj, @id_miasto ,@ulica, @telefon, @id_branza, @www, @mail, @kod, @numer_pos, @kierunkowy
removed.
I agree with you that this is an issue that should be addressed...
2)dvitner wrote:Notice how that "AND @id_woj is not NULL" got broken into two lines.
removed.
...and this too.
3)dvitner wrote:It would be nice if the non-necessary parens were removed.
SQL Refactor's Lay Out feature will not remove unused columns as we felt that most users probably wouldn't expect this to occur. But we are planning a feature which should highlight params and variables that aren't used, this would then allow users to delete them at their discretion. However, in the case of cursors it would rely on users remembering to also remove the unused columns which wouldn't be highlighted. This is an interesting problem you have posed us here.
4)dvitner wrote:BTW, guys, is there a way to export my current settings? I believe it would be useful if I could somehow attach the current settings to this post. I can't seem to find where it's written to..
Not yet but I agree that this would be a good idea. Hopefully, we can squeeze it in, but I cannot promise anything.
Many thanks,
Jonathan
Add comment
Please sign in to leave a comment.
declare tb cursor for (select
nazwa,id,id_woj,id_miasto,ulica,telefon,id_branza,www,mail,kod,numer_pos,kierunkowy
from xx_zrodlo where id_portal is null)
open tb
fetch next from tb into
@nazwa,@id,@id_woj,@id_miasto,@ulica,@telefon,@id_branza,@www,@mail,@kod,@numer_pos,@kierunkowy
@fetch_status = 0
begin
IF @id_miasto <>0 AND @id_miasto is not NULL AND @id_woj<>0 AND @id_woj is
not NULL AND @id_branza<>0 AND @id_branza is not NULL
BEGIN
-- snip
END
fetch next from tb into
@nazwa,@id,@id_woj,@id_miasto,@ulica,@telefon,@id_branza,@www,@mail,@kod,@numer_pos,@kierunkowy
end
close tb
deallocate tb
Lay Out gave me this:
declare tb cursor for (select
nazwa,
id,
id_woj,
id_miasto,
ulica,
telefon,
id_branza,
www,
mail,
kod,
numer_pos,
kierunkowy
from
xx_zrodlo
where
id_portal is null)
open tb
fetch next from tb into
@nazwa,@id,@id_woj,@id_miasto,@ulica,@telefon,@id_branza,@www,@mail,@kod,@numer_pos,@kierunkowy
@fetch_status = 0
begin
IF @id_miasto <> 0
AND @id_miasto is not NULL
AND @id_woj <> 0
AND @id_woj is
not NULL
AND @id_branza <> 0
AND @id_branza is not NULL
BEGIN
-- snip
END
fetch next from tb into
@nazwa,@id,@id_woj,@id_miasto,@ulica,@telefon,@id_branza,@www,@mail,@kod,@numer_pos,@kierunkowy
end
close tb
deallocate tb
Several things here I dislike:
declare tb cursor for (select
nazwa,
...)
It would be nice if the non-necessary parens were removed. Also, the "select" should be on the next line. So, something like this:
declare tb cursor for
select
nazwa,
etc.
kierunkowy
from
xx_zrodlo
where
id_portal is null
Further on, in the fetch statement, there should be a space after commas between the variables:
fetch next from tb into
@nazwa, @id, @id_woj, @id_miasto ,@ulica, @telefon, @id_branza, @www, @mail, @kod, @numer_pos, @kierunkowy
Or, even better, this:
fetch next from tb into
@nazwa,
@id,
@id_woj,
@id_miasto,
@ulica,
@telefon,
@id_branza,
@www, @mail,
@kod,
@numer_pos,
@kierunkowy
It's a matter of preference, though.
And then the IF statement. It was turned into this:
IF @id_miasto <> 0
AND @id_miasto is not NULL
AND @id_woj <> 0
AND @id_woj is
not NULL
AND @id_branza <> 0
AND @id_branza is not NULL
BEGIN
Notice how that "AND @id_woj is not NULL" got broken into two lines.
BTW, guys, is there a way to export my current settings? I believe it would be useful if I could somehow attach the current settings to this post. I can't seem to find where it's written to..
Dean