Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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

SELECT ..., ..., 'HardCodeValue' as hardCodeDefaultValueColumn
FROM ...
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading