Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help manipulating output string based on BIT value of field

Status
Not open for further replies.

jasonsalas

IS-IT--Management
Joined
Jun 20, 2001
Messages
480
Location
GU
I think this is a formatting issue, but here's my dilemma. I've got a table with the following schema:

NAME INCUMBENT
VARCHAR(120) BIT

What I'd like to do is return a recordset wherein if a record has a value of "TRUE", then the name field will append certain HTML markup, like so:

SELECT * FROM TablePeople
------------------------------
NormalPerson
Incumbent&nbsp;<font size=&quot;2&quot; color=&quot;red&quot;>*</font>
AnotherNormalPerson
YetAnotherNormalPerson
AnotherIncumbent&nbsp;<font size=&quot;2&quot; color=&quot;red&quot;>*</font>

Do you know how I can query the same table and append this data?

Thanks much!
 
You will probably need an order by clause:

select name + case when INCUMBENT = 1 then ' <font size=&quot;2&quot; color=&quot;red&quot;>*</font>' else '' end
from tbl
order by ?

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Thank you very much! That did it perfectly!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top