SELECT without table (FROM CLAUSE) in DB2


You are here because you are trying to generate a string using a SELECT statement in DB2, much like you would do in SQL SERVER.  In other words, you want to execute a SELECT statement without the FROM clause in DB2 as you would in SQL SERVER.  Below is how you do that.

In SQL Server, if you wanted to a string of text to be returned to you, you would simply type:

SELECT 'Whatever you want your string to say'

The results would be :

Whatever you want your string to say  

In the results tab.

If you want to accomplish the same thing in DB2, instead of SELECT, use the word VALUES.  So your statement would be typed like this:

VALUES 'Whatever  you want your string to say'

The results will be the same

This is comparable to a SELECT statement with NO FROM clause in SQL SERVER

This is comparable to a SELECT statement with NO FROM clause in SQL SERVER

Leave a comment

Filed under SQL

Comments are closed.