Came across this code today:
SELECT 'Overall' as Main,
wave,
country,
catg,
'' AS hw,
SUM(0) AS headwinds_sum
....
....
Can someone explain what ‘ ‘ in the above stands for?
Its not a typo as it is repeated @multiple instances.
Not a typo, no text was missed to add.
2
Answers
adds a column named
hw
to your select query of typevarchar
that contains empty strings.Depending on how you process the resultset afterwards this can make sense.
The symbol is used to return an empty column in a result set. Users occasionally do this to match column counts in insert selects or when exporting data to Excel files and you want standard column names for capturing audit recommendations on data etc.