beyondrelational.com



Formatting your code when posting in the forums

rated by 0 users
This post has 3 Replies | 1 Follower

Top 10 Contributor
Male
Posts 937
Points 15,538
Jacob Sebastian Posted: 01-28-2010 4:32 AM

When posting questions in the forums with TSQL code, it may be a good idea to format your code so that it looks better in the forums. When the code is formatted and keywords are colored, it will make the code easier to understand.

You can add formatting to the code by placing your code between a <pre> block. Here is an example of a piece of code that uses formatting tags.

<pre class="brush:sql">
-- Check current time
SELECT GETDATE()
</pre>

The above code will be formatted and printed as follows in the forums

-- Check current time
SELECT GETDATE()

Jacob Sebastian, SQL Server MVP

See this post that explains how to format TSQL code listing when posting in this forum.

  • | Post Points: 20
Top 10 Contributor
Posts 129
Points 1,245

Thanks, But sometimes evethough I do it, by default it adds this tag

<divre...>...</divre>

Any reason?

  • | Post Points: 20
Top 10 Contributor
Male
Posts 937
Points 15,538
I think it is the editor control that does it. The best is to compose your text and then go to 'html' view(there is a button on the toolbar of the editor) and paste the tsql code within the <pre> block.

Jacob Sebastian, SQL Server MVP

See this post that explains how to format TSQL code listing when posting in this forum.

  • | Post Points: 20
Top 10 Contributor
Posts 129
Points 1,245

Yes. Usually I do this only

  • | Post Points: 5
Page 1 of 1 (4 items) | RSS
Copyright © Beyondrelational.com