How to add T-SQL code to your WordPress blog

Standard

Ok, so as a new member of WordPress and the blogosphere (I’ve only been part of the Twitterati for one single year (I signed up at SQLBits XI) (I just wanted to say Twitterati)) I’m still finding my way around. My first question was “How in the name of Greek buggery do I add T-SQL code to my blog and make it look decent?”. Here’s how I tell ya!!

Step 1: Write your SUPERAWESOME code:

SELECT * FROM Dim.Booking

Step 2: Make it pretty: Prettifier

Step 3: Hit the Text button just above and to the right:
TextButton

Step 4: Put the results from Prettifier into some <pre class=”code“></pre> tags on the Text page where you want it

<pre class=”code“>

<code style=”font-size: 12px;”>
<span style=”color:blue”>SELECT </span>
<span style=”color:gray”>* </span>
<span style=”color:blue”>FROM </span>
<span style=”color:black”>Dim.Booking</span>
</code>

</pre>

Step 5: PROFIT:

SELECT * FROM Dim.Booking