Daily Archives: Sep 9, 2014

Convert a comma separated list into table 4

In this post, we are going to learn “how we can convert a comma separated list into a table using a recursive CTE”. Below is the code:


Hint OPTION(MAXRECURSION 32767) is a query hint which instructs to compiler to iterate 32767 times. Default, max recursion of a loop in SQL is 100 and in case we will not put this hint at the end, any string which requires more loop than 100 will raise an error.
To avoid the error we have used OPTION(MAXRECURSION 32767).

Thanks for reading.… More

Set Width of gridview columns dynamically when AutoGenerateColumns is true 1


I faced a lot of problems when I asked to set the width of a gridview dynamically, that is the property AutoGenerateColumns set to AutoGenerateColumns=”true” and the gridview was directly bounded from a dataset in code behind. Thus, we don’t have bound fields to set the width of columns individually. I tried a lot of methods found over the internet but sadly anyone could not help me. But I have overcome the problem using some tricks and am now sharing this article with all of you so that if anyone has a problem like me, he will not get more frustrated.


I used many methods found over the internet, but they could not work for me. Then I used both methods – that is one for bound field and another for setting the AutoGenerateColumns=”true” – individually in two projects and then when page got rendered in browser, I … More