I notice that when I use this operator, the column is Actionnot NULL:
SELECT TOP 0 SerialNumber, 0 [Action] INTO
But when I use this operator, the column Actionis NULL:
SELECT TOP 0 SerialNumber, CAST(0 as int) [Action] INTO
My reason for creating a table this way is that I do not want the temporary table to inherit the SerialNumber sort from the server's default sort setting or elsewhere. I want it to match the FSE_SerialNumber..SerialNumber mapping.
My question is, can I rely on a translation function that gives me columns with a null value, or is this explicitly undefined and can change. Why does a cast unexpectedly cause a column to nullify? Is there a better way (besides comments) to make it clear that my intention is to get a column with a null value?
source
share