sqlhardcode

Returning default values in SQL queries


I have a query in SQL where I select a couple of attributes from a few tables. However, I also need to return default hardcoded values such as 'HardCodeValue' in the results. I am not querying a table/column however for this but I do want a column in the results set called 'hardCodeDefaultValueColumn' with this hardcoded default value for every row in th result set.

Is there any way I can do this in SQL?

Thanks


Solution

  • Just add 'HardCodeValue' as hardCodeDefaultValueColumn in your SELECT, among the other columns selected, like so:

    SELECT ..., ..., 'HardCodeValue' as hardCodeDefaultValueColumn
    FROM ...