Home Forums SQL Server 7,2000 Strategies A Case For Concatenation (Building Delimited Strings ) In T-SQL RE: A Case For Concatenation (Building Delimited Strings ) In T-SQL

  • I'm a fan of letting the UI or business layer handle formatting the data and let SQL Server return the data. I know I can do a lot of formatting in T-SQL and I have at times, but that's not what it is best at so I try not to do it there. I'm not a hard-liner on either side, I'm more concerned with making it work and so anyone can read it and debug it. In the example you present I would consider the SQL you have doing the concatenation advanced SQL and most people would not understand it, while doing the concatenation in VB or C# would be a simple loop that any novice programmer could read and debug.

    Here are a couple of blog posts. The first one on the do it the presentation layer side and the second on the do it in SQL sometimes side.

    http://sqlblog.com/blogs/jonathan_kehayias/archive/2009/02/19/sql-tip-keep-your-presentation-logic-in-your-presentation-layer.aspx

    http://sqlblog.com/blogs/alexander_kuznetsov/archive/2009/02/20/should-i-always-keep-my-presentation-logic-in-my-presentation-layer.aspx