Solved

SQL EASY QUESTION ?

Posted on 2004-03-25
7
200 Views
Last Modified: 2010-04-05
I want this instruction  give me string result not Boolean value

Select  table1.booleanfield where table1.name=jone

What I want is : if booleanfield = true then the result of  instruction is ‘ good ‘
                           if booleanfield = false then the result of  instruction is ‘ bad ‘

I am waiting your  for your help .
0
Comment
Question by:peruzzi
7 Comments
 
LVL 3

Expert Comment

by:concon
ID: 10675501
Hi peruzzi,

what is your db? if sql/server :

select case(booleanfield
            when true then 'good'
            when false then 'bad'
            end) from table1 where name='jone'

Regards.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 10675517
there is a TBooleanField,
which should be automatically
assigned to your table-boolean field

there is a property DisplayValues
add there good;bad

meikl ;-)
0
 
LVL 6

Accepted Solution

by:
wimmeyvaert earned 20 total points
ID: 10676125
I think kretzschmar has it right.

Some more explanation :

If you doubleclick your TTable-Component in Delphi IDE, then do CTRL-F to add all fields linked to the Table you provided in TableName-property of your TTable.

Now you should see the BooleanField between all the other fields. Click on this field an go to the Object Inspector. change the Property 'DisplayValues' into good;bad.

If you now drag and drop this BooleanField from the FieldEditor (doubleclicking on TTable) to your Form, you should see 'good' if this field contains True and 'bad' if the field contains 'False' at runtime.

Hope I was of some help. Anyway the Kretzschmar had the right answer to your Q. I just tried to clarified the way of working.

Best regards,

The Mayor.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 6

Expert Comment

by:wimmeyvaert
ID: 10676164
This also works for a TQuery-component !!
0
 

Author Comment

by:peruzzi
ID: 10679109
Hi guys
wimmeyvaert , I choose your answer
I wanted to spilt the points between you and kretzschmar but I could not
so I choose the useful answer for me and give it the point.
 thank thanks for all
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 10679675
hi peruzzi,

this is ok

wimmeyvaert explains it complete, so he earnes the points.
i'm not worry about this.

good luck again

meikl ;-)
0
 
LVL 6

Expert Comment

by:wimmeyvaert
ID: 10684819
Hi all,

Kretzschmar, thanks you are ok with it.
It was not my intention to steel the points from you. I just explained in detail what you suggested.
Long live the fairness !!!

Thanks again,

The Mayor.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Path  to current project in Delphi. 2 92
Intraweb download file link ? 1 154
delphi parse string to params 3 136
Why can't I create any project with my delphi EXE file? 6 39
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

839 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