30.06.2013 Views

SQL Server Team-based Development - Red Gate Software

SQL Server Team-based Development - Red Gate Software

SQL Server Team-based Development - Red Gate Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 2: Documenting your Database<br />

AS<br />

GO<br />

BEGIN<br />

RETURN CASE WHEN PATINDEX(<br />

'%[A-Za-z0-9-]%', @string COLLATE Latin1_General_CS_AI<br />

) > 0 THEN 0<br />

ELSE 1<br />

END<br />

END<br />

Listing 2-2: A header in XMLDOCS format.<br />

Extracting the XML file from the comments isn't too hard and, once we've got it, we can<br />

put it into Sandcastle. What you want to aim for is as shown in Listing 2-3.<br />

<br />

<br />

IsSpace string Function Returns Non-Zero if all characters in<br />

@string are whitespace characters, 0 otherwise.<br />

<br />

Select dbo.IsSpace('how many times must i tell you')<br />

<br />

<br />

Select dbo.IsSpace(' &lt;&gt;[]{}"!@#$%9 )))))))')<br />

<br />

<br />

Select dbo.IsSpace(' ????/&gt;.&lt;,')<br />

<br />

integer: 1 if whitespace, otherwise 0<br />

<br />

Listing 2-3: Extracting the XML file from the XMLDOCs header.<br />

However, this is just a fragment from the file you need to produce. Notice that you ought<br />

to escape certain characters. This makes the translation more complicated.<br />

It isn't hard to see from this why the XMLDOCS convention never really caught on,<br />

beyond using the summary tag to generate intellisense. It is awkward. It makes the code<br />

44

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!