How to implement if-then-else in a select clause in sybase?



How to implement if-then-else in a select clause in sybase?..

Answer / Avinash Pandey

Sybase does not directly support the IF-THEN-ELSE construct in the SELECT statement. However, you can achieve similar functionality using CASE expressions:

```sql
SELECT column1,
CASE
WHEN condition1 THEN value1
WHEN condition2 THEN value2
ELSE default_value
END AS new_column
FROM table_name;
```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Sybase Interview Questions

How do you check database space? What measures are there to increase the db space?

1 Answers  


explain engines?

1 Answers  


How do I pipe the output of isql to a file in sybase?

1 Answers  


How to view the log files in sybase?

1 Answers  


Explain relationship between jdbc and sybase.

1 Answers  


What is the stored procedure to view current lock and processes respectively?

1 Answers  


What is raid and sybase?

1 Answers  


Can I partition any table in sybase ?

1 Answers  


What is the timestamp datatype in sybase?

1 Answers  


Is sybase relational database?

1 Answers  


How do I connect to a sybase database?

1 Answers  


what is the difference between dbcc checkstorage and other dbcc commands

2 Answers  


Categories