You could use either CASE or ISNULL or COALESCE for such a thing. I used ISNULL in the following example. Also, you would do better for yourself if you provided your data as readily consumable data so people can test their answer before posting it. See the first link in my signature below for an article on how to do that correctly.
SELECT RTRIM(
+ 'ColA:'+ISNULL(ColA,'')+', '
+ ISNULL('ColB:'+CAST(ColB AS VARCHAR(10))+' ','')
+ ISNULL('ColC:'+CAST(ColC AS VARCHAR(10))+' ','')
+ ISNULL('ColD:'+CAST(ColD AS VARCHAR(10))+' ','')
)
FROM
( --=== Similation of your table. Use your table name here
SELECT 'Admin',NULL,NULL,NULL UNION ALL
SELECT 'Market',101,256,258 UNION ALL
SELECT 'Sales',205,125,NULL UNION ALL
SELECT 'Admin',256,258,548
)d(ColA,ColB,ColC,ColD)
;
--Jeff Moden
Change is inevitable... Change for the better is not.