June 23, 2009 at 1:36 am
Hi,
I've read Jeff Moden's guide to Forum posting, and have seen examples where code is in its own dedicated window, complete with SS2K5 syntax colouring - so am keen to follow these guidelines.
However, when I tried to do this, my code appeared as if i'd just typed it in the question text (in one big mess of black text)
When posting how do I get my code into the dedicated window?
Thanks,
Jason
---
June 23, 2009 at 2:06 am
In the reply screen, take a look to the left of the text area. You'll see several IFCode shortcuts. Highlight your code and click the code shortcut, or you can manually wrap it in code tags - [ code ] [ /code ] (remove spaces)
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
June 23, 2009 at 2:11 am
select'Thanks Gail' union all
select'Most appreciated' union all
------------------------------
select'Regards.....Jason'
June 23, 2009 at 2:57 am
While we're on the subject: I've been wanting to experiment with these [ code ] blocks for a while, as they don't always do what I expect.
SELECT
'blank line above',
'and below'
above omits the blank lines (but seems to add them back between the code block and this text!
deliberatly using a [ code="noncode" ] codeblock (which isn't allowed, just to try to get the old-style code block)
EDIT: Changed to [ quote ] as the IE popup error was too annoying.
SELECT
'blank line above',
'and below'
above gives me some IE errors in preview - but preserves the blank lines
(syntax highlighter can't find brush for 'noncode')
[ code="text" ]
SELECT
'blank line above',
'and below'
above misses out the blank lines again
Jeff manages to get his code formatted in IE without errors or missing blanks, (or the wierd select problem that means you can't always paste back into SSMS and just run it) How?
June 23, 2009 at 6:06 am
Tom i don't think noncode is a valid descriptor; i think you need to use plain or text.
i saved this from a post previously so i had the valid tags handy:
C++ [ code=”c”] or [ code=”cpp”]
C# [ code=”c#”] or [ code=”csharp”] or [ code=”c-sharp”]
CSS [ code=”css”]
Java [ code=”java”]
JavaScript [ code=”js”] or [ code=”jscript”] or [ code=”javascript”]
PHP [ code=”php”]
Plain (text) [ code=”plain”] or [ code=”text”]
SQL [ code] or [ code=”sql”]
VB.NET [ code=”vb”] or [ code=”vbnet”]
XML [ code=”xml”] or [ code=”xslt”] or [ code=”html”] or [ code=”xhtml”]
Lowell
June 23, 2009 at 6:23 am
Tom Brown (6/23/2009)
SELECT
'blank line above',
'and below'
above gives me some IE errors in preview - but preserves the blank lines
(syntax highlighter can't find brush for 'noncode')
And in Firefox gives those errors twice every time the page is viewed. Would you perhaps consider editing it out for those of us using Firefox?
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
June 23, 2009 at 6:33 am
Gail: Done - it was annoying I agree.
June 23, 2009 at 7:04 am
What I was trying to find out is how Jeff does it
e.g. this from another thread (which pastes into SSMS well, preserving line breaks and blank lines)
Jeff Moden (6/20/2009)
As a side bar, for those interested in a Tally table solution that will work in virtually any release of SQL Server...[font="Courier New"]--===== Build the test table as the data source
CREATE TABLE dbo.TableA (Column1 VARCHAR(5), Column2 VARCHAR(30))
INSERT INTO dbo.TableA
(Column1, Column2)
SELECT 'a1', '1:3:5:6' UNION ALL
SELECT 'a2', '2:4:5'
--===== Solution for virtually any version of SQL Server
INSERT INTO dbo.TableB
(Column1, Column2)
SELECT a.Column1,
SUBSTRING(a.Column2, t.N+1, CHARINDEX(':', a.Column2, N+1) - N-1) AS Column2
FROM dbo.Tally t
CROSS JOIN
(SELECT Column1, ':'+Column2+':' AS Column2 FROM dbo.TableA) a
WHERE N < LEN(a.Column2)
AND SUBSTRING(a.Column2, N, 1) = ':'
[/font]
But quoting it shows me he's done it the long way with loads of [ color ] and [ font ] tags
Also wondered if you can still achieve this
--============================================================================= -- Setup --============================================================================= USE TempDB --DB that everyone has where we can cause no harm SET NOCOUNT ON --Supress the auto-display of rowcounts for appearance/speed DECLARE @StartTime DATETIME --Timer to measure total duration SET @StartTime = GETDATE() --Start the timer --============================================================================= -- Create and populate a Tally table --============================================================================= --===== Conditionally drop and create the table/Primary Key IF OBJECT_ID('dbo.Tally') IS NOT NULL DROP TABLE dbo.Tally CREATE TABLE dbo.Tally (N INT, CONSTRAINT PK_Tally_N PRIMARY KEY CLUSTERED (N)) --===== Create and preset a loop counter DECLARE @Counter INT SET @Counter = 1 --===== Populate the table using the loop and couner WHILE @Counter <= 11000 BEGIN INSERT INTO dbo.Tally (N) VALUES (@Counter) SET @Counter = @Counter + 1 END
evidently you can using a
tag But Note: that one doesn't paste into SSMS well (all one long line)
June 23, 2009 at 7:06 am
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply