SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


FOR XML PATH


FOR XML PATH

Author
Message
Tom Thomson
Tom Thomson
One Orange Chip
One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)

Group: General Forum Members
Points: 25340 Visits: 12488
paul.goldstraw (2/25/2010)
I would say fixed width makes it easier to indent your code since every character fits in a same size block. For me, that's the only reason, it's mere personal preference beyond that. Not sure if others have other reasons why?

I'm not sure there are any fixed width fonts that let me use even a full range of eurpean latin-based alphabets, let alone Cyrillic and Arabic too, and certainly not Japanese, Chinese, Korean and various Indian alphabets. Since I have worked mostly in a fairly international environments, and want to work usually in Unicode, this tends to force me onto variable width fonts. Of course it then makes sense to use fixed width (measured in inches or metres or whatever) tabs, rather than letting tabs represent a number of characters from the margin.

Tom

vk-kirov
vk-kirov
SSCarpal Tunnel
SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)

Group: General Forum Members
Points: 4300 Visits: 4408
bc_ (2/25/2010)
is there an advantage to using a fixed width font? or is it personal preference?

Fixed-width fonts allow to adjust and beautify a piece of code easily.

Simple example (Courier New):
CREATE TABLE #TEST_TABLE
( Id INT NOT NULL IDENTITY,
Customer_Id INT NOT NULL,
Customer_Name VARCHAR(100) NOT NULL,
Invoice_Id INT NULL,
Invoice_Total MONEY NULL,
Invoice_Tax MONEY NULL,
Discount_Percent NUMERIC(5,2) NULL
)



With Arial Black, this code will look like:
CREATE TABLE #TEST_TABLE
( Id INT NOT NULL IDENTITY,
Customer_Id INT NOT NULL,
Customer_Name VARCHAR(100) NOT NULL,
Invoice_Id INT NULL,
Invoice_Total MONEY NULL,
Invoice_Tax MONEY NULL,
Discount_Percent NUMERIC(5,2) NULL
)



Alignment is not as good as before, and (it's more important) another developer will see a total mess when he/she opens the code in his/her SSMS. I think the developer will not be happy :-)

Delphi, Clarion, Visual Studio, Query Analyzer, SSMS, PL/SQL Developer - all of these use fixed-width fonts by default...
Kelsey Thornton
Kelsey Thornton
SSC Eights!
SSC Eights! (865 reputation)SSC Eights! (865 reputation)SSC Eights! (865 reputation)SSC Eights! (865 reputation)SSC Eights! (865 reputation)SSC Eights! (865 reputation)SSC Eights! (865 reputation)SSC Eights! (865 reputation)

Group: General Forum Members
Points: 865 Visits: 282
Fatal Exception Error (2/23/2010)
Good Question

I got it right but for the wrong reason's(process of elimination) in my opinion.

I must say I am not a fan of the image since I could not copy the SQL and format it(not run it) to my liking.

Don't see why you'd consider that the wrong reason - worked just as well for me.

To (badly?) quote Sherlock Holmes (or Sir A. C. Doyle if you prefer)
"Once you have elimiated the impossible, then whatever is left, however improbable, must be the answer"...

Kelsey Thornton
MBCS CITP
Kelsey Thornton
Kelsey Thornton
SSC Eights!
SSC Eights! (865 reputation)SSC Eights! (865 reputation)SSC Eights! (865 reputation)SSC Eights! (865 reputation)SSC Eights! (865 reputation)SSC Eights! (865 reputation)SSC Eights! (865 reputation)SSC Eights! (865 reputation)

Group: General Forum Members
Points: 865 Visits: 282
Tom.Thomson (2/25/2010)
paul.goldstraw (2/25/2010)
I would say fixed width makes it easier to indent your code since every character fits in a same size block. For me, that's the only reason, it's mere personal preference beyond that. Not sure if others have other reasons why?

I'm not sure there are any fixed width fonts that let me use even a full range of eurpean latin-based alphabets, let alone Cyrillic and Arabic too, and certainly not Japanese, Chinese, Korean and various Indian alphabets. Since I have worked mostly in a fairly international environments, and want to work usually in Unicode, this tends to force me onto variable width fonts. Of course it then makes sense to use fixed width (measured in inches or metres or whatever) tabs, rather than letting tabs represent a number of characters from the margin.


I always use the "so-called"(?) fixed-width fonts in code and eschew tabs like the plague.
The latter is a klingon from an ancient Fortran compiler which would crash if it saw a tab anywhere EXCEPT as the very first character on a line. I still hate tabs in code as my colleagues will no doubt attest. :-)
The only place where I use tabs is in word-processed documentation (where it *is* better).

Kelsey Thornton
MBCS CITP
Paul White
Paul White
SSC-Dedicated
SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)

Group: General Forum Members
Points: 34180 Visits: 11359
The poor UNION statement, abused again Sad



Paul White
SQLPerformance.com
SQLblog.com
@SQL_Kiwi
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