Welcome to TechNet Blogs Sign in | Join | Help

Scripts for “SQL Tricks: Insights from Microsoft IT”

UPDATED 22 November 2008 with Code Gallery URL.

A ZIP file of the scripts from the SQL Tricks: Insights from Microsoft IT presentation I’m giving in Barcelona this week is available for download here.  The tricks will be familiar to long-time denizens of this space, as they’ve all been discussed here before; I hope the provision of sample scripts demonstrating each technique will make them even more useful to you.

As always, please let me know if you have any questions or suggestions.

     -wp

Published Tuesday, November 11, 2008 10:00 AM by Ward Pond

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Scripts for “SQL Tricks: Insights from Microsoft IT”

Friday, November 28, 2008 9:00 AM by Jude

Cool tricks!

And XML string concatenation trick!

I'm not too expirienced with SqlServer, but everyone knows this:

declare  @a varchar(max)

select @a=isnull(@a+', '+parentstring,parentstring)

from

parent p join child c on p.parentid=c.parentid where c.childid=2

select @a

which yeilds the same results.

# re: Scripts for “SQL Tricks: Insights from Microsoft IT”

Sunday, November 30, 2008 9:58 PM by Ward Pond

Hi Jude..

You're correct; the syntax you nominate would give the same result as the XML concatenation trick.  However, your syntax is not ANSI standard, and is therefore not something that I'd encourage.

The XML concatenation trick is fully ANSI compliant, which is why I prefer it.

Thanks for your note!

    -wp

# http://code.msdn.microsoft.com/wardpondteched2008

Wednesday, December 03, 2008 3:36 PM by TrackBack

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker