conditions in the select clause?

G

Guest

Hi:

IN SQL Server you can put conditions to the fields on the SELECT clause by
using
CASE, WHEN, THEN, ELSE, END.

Is there a way to put conditions to the outputs of a field?

for example:

SELECT CASE WHEN LEN(Field1)< 3 THEN "Yes" else "No" end AS MyFieldName,
Field2, Fikeld3
From MyTable

(this is possible in SQL 2000)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top