Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Code Formatting


Code Formatting

Author
Message
StarNamer
StarNamer
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1294 Visits: 1992
GilaMonster (3/18/2009)
Steve Jones - Editor (3/17/2009)
New code formatting has been released on SSC.


Ooooohhhh..... Nice!

Jack Corbett (3/17/2009)
This has been a light day for me posting code. I've mainly added links.


I don't think I've posted any code this week yet.


If you look, you'll find that all existing code is now being displayed with color highlighting...

I wonder if that's broken anything? I think I may have used a construct like

[ c o d e ] ..... ; [ b ] [ / b ] ) ... [ / c o d e ]

and relied on the bold tag getting hidden! I will have to go look...

Derek
GilaMonster
GilaMonster
SSC-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47239 Visits: 44377
I think the string and comment handling needs a little more work
http://www.sqlservercentral.com/Forums/FindPost678555.aspx

--here's a single quote within a comment
select 'String 1', 012
select 'String 3', 789 -- that's not what I wanted to see
select 'String 5', 456 -- that's better
select 'String 7', 123 -- not quite




Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


StarNamer
StarNamer
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1294 Visits: 1992
Bob posted some code here. Bob's code looks OK, but I think the formatter saw a single quote in the comment and hence was thown out of phase.


-- based on what we've seen
insert #t
select 'this is how' union all
select 'we insert data' union all
select 'for testing'

declare @i int
-- wouldn't it be nice to insert arrays so you didn't need to do union all
set @i = 1
select k as 'kay'

/*
block comments aren't right either
what happens if I insert one
*/
select j as 'jay'



Basically, it looks like the scanner is recognizing single quotes in comments and hence getting confused. I've attache a screenshot previewing the above rather than try to describe it.

Derek
Attachments
ssc screenshot 2.bmp (5 views, 890.00 KB)
Lowell
Lowell
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14956 Visits: 38953
i noticed if i add an 800 line [code] block, it'll show all 800 lines; i'd rather have a scrollbar for the code in question, if possible.

Lowell

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Lynn Pettis
Lynn Pettis
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24186 Visits: 37954
Copying and pasting code from the forum, the code becomes double spaced and it loses it formatting (indention for one).

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Steve Jones
Steve Jones
SSC-Dedicated
SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)

Group: Administrators
Points: 36107 Visits: 18742
Lowell, good point. We should probably limit areas to 40-50 lines tops.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
StarNamer
StarNamer
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1294 Visits: 1992
Since the formatting is active for historical code, you also have interesting effects where the 'code' wasn't t-sql, for example
http://www.sqlservercentral.com/Forums/FindPost661664.aspx


Or where I inserted 'font' tags in the code to produce a color effect, which of course, are now visible.
http://www.sqlservercentral.com/Forums/FindPost669471.aspx

Derek
StarNamer
StarNamer
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1294 Visits: 1992
How easy would it be to revert the [ code ][ /code ] tags to work as before and add a new set of [ tsql ][ /tsql ] tags?

Hence old usage wouldn't break and people could preview that new [ tsql ] sections were valid.

Derek
Steve Jones
Steve Jones
SSC-Dedicated
SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)

Group: Administrators
Points: 36107 Visits: 18742
I shall ask

There should be a [ code2 ] set of tags for XML as well.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Michael Valentine Jones
Michael Valentine Jones
Hall of Fame
Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)

Group: General Forum Members
Points: 3254 Visits: 11771
It doesn't seem to handle tab indents very well. The indents below are all over the place, even though they are all a single tab character.

I think it would be easier to read with a non-proportional font for the display, since that is usually the way we usually see it in a code editor.

select
*
from
Mytable
where
MyColumn1 in (1,2)
order by
MyColumn33


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search