How do I return a constant from an sql statement?
For example how would I change the code below so "my message" would return if my (boolean expression) was true
if (my boolean expression) "my message" else select top 1 name from people;
I am using ms sql 2000
A constant, also known as a literal or a scalar value, is a symbol that represents a specific data value. The format of a constant depends on the data type of the value it represents.
The RETURN statement is used to unconditionally and immediately end an SQL procedure by returning the flow of control to the caller of the stored procedure. When the RETURN statement runs, it must return an integer value.
The Constant query expression (cq) is a part of the combined query expression (the cq value) similar to the advanced query expression ( aq ), but that must hold expressions such as a search scope that are constant for all users of a specific search interface or search tab.
The IN operator checks a value within a set of values separated by commas and retrieve the rows from the table which are matching. The IN returns 1 when the search value present within the range otherwise returns 0.
Did you try:
select 'my message';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With