set @a = 'ssss$kkkk$ooooo$abcde'
Update: Of course, using it to trim out the last part of the string is going to be something like this:
A normal programmer, with normal problems, sometimes stupid, other times interesting. Just thought of giving something back to the community. All comments welcomed
Posted by Radu at 9:51 AM 0 comments
Labels: SQL Server 2005, string
Posted by Radu at 2:03 AM 2 comments
Well, that's what happen when you don't carefully read the documentation. I have recently discovered the benefit of the WITH ROLLUP clause in SQLServer 2005, and I thought what it was doing was returning all possible combinations of grouping.
Wrong, that's the WITH CUBE.
Using the WITH ROLLUP I found out that the number of rows returned by my query was dependent on the order of the fields in the group by clause. Funny.
Well, to keep it short, I found this: http://msdn.microsoft.com/en-us/library/ms189305%28SQL.90%29.aspx
because "ROLLUP generates a result set that shows aggregates for a hierarchy of values in the selected columns" we get results depending on this hierarchy.
unlike it, what I needed was the WITH CUBE clause: CUBE generates a result set that shows aggregates for all combinations of values in the selected columns.
Posted by Radu at 8:04 AM 0 comments
Labels: cube, rollup, SQL Server 2005