The perils of double-dash comments [T-SQL]

Posted by jamiet on SQL Blog See other posts from SQL Blog or by jamiet
Published on Thu, 06 Dec 2012 09:21:39 GMT Indexed on 2012/12/06 11:16 UTC
Read the original article Hit count: 210

I was checking my Twitter feed on my way in to work this morning and was alerted to an interesting blog post by Valentino Vranken that highlights a problem regarding the OLE DB Source in SSIS. In short, using double-dash comments in SQL statements within the OLE DB Source can cause unexpected results. It really is quite an important read if you’re developing SSIS packages so head over to SSIS OLE DB Source, Parameters And Comments: A Dangerous Mix! and be educated. Note that the problem is solved in SSIS2012 and Valentino explains exactly why.

If reading Valentino’s post has switched your brain into “learn mode” perhaps also check out my post SSIS: SELECT *... or select from a dropdown in an OLE DB Source component? which highlights another issue to be aware of when using the OLE DB Source.

As I was reading Valentino’s post I was reminded of a slidedeck by Chris Adkin entitled T-SQL Coding Guidelines where he recommends never using double-dash comments:

image

That’s good advice!

@Jamiet

© SQL Blog or respective owner

Related posts about SQL Server

Related posts about sql server integration se