Solved

SQL case statement with embeded html

Posted on 2013-01-14
2
270 Views
Last Modified: 2013-01-14
The following is a SQL extract from a very long query which runs fine.  However I am trying to add some HTML formatting so that I can run the sql query within a wiki.  I have everything worked out just fine.  However I want the ?????? to return the value for bob from the database.  Currently it will return text "??????".  I want it to return the value from the database IE "25".

,CASE
      WHEN bob >= 10 THEN '<span style="background: #FFF; border: 1px solid #999;padding: 1px 12px;">??????</span>'
      WHEN bob < 10THEN '<span style="background: #FFFFF0; border: 1px solid #999;padding: 1px 12px;">??????</span>'
      WHEN bob < 5 THEN '<span style="background: #e99; border: 1px solid #999;padding: 1px 12px;">??????</span>'
      ELSE '--'
      END AS bob
0
Comment
Question by:JohnMad
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 500 total points
ID: 38776114
try using this (3 times):
WHEN bob >= 10 THEN '<span style="background: #FFF; border: 1px solid #999;padding: 1px 12px;">' + convert(varchar, bob) + '</span>' 

Open in new window

0
 

Author Closing Comment

by:JohnMad
ID: 38776149
quick and concise help
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question