How to count items in comma separated list MySQL

There is no built-in function that counts occurences of substring in a string, but you can calculate the difference between the original string, and the same string without commas: LENGTH(fooCommaDelimColumn) – LENGTH(REPLACE(fooCommaDelimColumn, ‘,’, ”)) It was edited multiple times over the course of almost 8 years now (wow!), so for sake of clarity: the query … Read more

How to Replace Multiple Characters in SQL?

One useful trick in SQL is the ability use @var = function(…) to assign a value. If you have multiple records in your record set, your var is assigned multiple times with side-effects: declare @badStrings table (item varchar(50)) INSERT INTO @badStrings(item) SELECT ‘>’ UNION ALL SELECT ‘<‘ UNION ALL SELECT ‘(‘ UNION ALL SELECT ‘)’ … Read more

Use a Query to access column description in SQL

If by ‘description’ you mean ‘Description’ displayed in SQL Management Studio in design mode, here it is: select [Table], [Column], sep.value [Description] from sys.tables st inner join sys.columns sc on st.object_id = sc.object_id left join sys.extended_properties sep on st.object_id = sep.major_id and sc.column_id = sep.minor_id and”MS_Description” where = @TableName and … Read more

Enterprise Reporting Solutions [closed]

I’ve used Cognos Series 7, Cognos Series 8, Crystal Reports, Business Objects XI R2 WebIntelligence, Reporting Services 2000, Reporting Services 2005, and Reporting Services 2008. Here’s my feedback on what I’ve learned: Reporting Services 2008/2005/2000 PROS Cost: Cheapest enterprise business intelligence solution if you are using MS SQL Server as a back-end. You also have … Read more